Snippets Collections
<?php
// Grab the metadata from the database
$text = get_post_meta( get_the_ID(), 'yourprefix_text', true );

// Echo the metadata
echo esc_html( $text );
?>
function insertText(data) {
	var cm = $(".CodeMirror")[0].CodeMirror;
	var doc = cm.getDoc();
	var cursor = doc.getCursor(); // gets the line number in the cursor position
	var line = doc.getLine(cursor.line); // get the line contents
	var pos = {
		line: cursor.line
	};
	if (line.length === 0) {
		// check if the line is empty
		// add the data
		doc.replaceRange(data, pos);
	} else {
		// add a new line and the data
		doc.replaceRange("\n" + data, pos);
	}
}
php artisan cache:clear
chmod -R 777 storage/
composer dump-autoload
'''
Autor: Antonio de Jesús Anaya Hernández
Github: @kny5
Program: Parametric polygon shape generator for laser cutting with kerf and dxf output.

'''
import math
import ezdxf
import random

# Parameters
sides = random.randrange(3, 10, 1)
radius = 40
origin = (100,100)
slot_depth = radius/2
kerf = 0.2
material_thickness = 5

class dxf_file():
    def __init__(self, __filename):
        self.filename = __filename
        self.file = None
        self.create_dxf()

    def create_dxf(self):
        self.file = ezdxf.new('R2018')
        self.file.saveas(self.filename)

    def save_dxf(self):
        self.file.saveas(self.filename)

    def add_vectors_dxf(self, vectors):
        self.model = self.file.modelspace()
        for vector in vectors:
            self.model.add_line(vector[0], vector[1])
            self.save_dxf()


def rotate_point(point, pivot, angle):
    x = ((point[0] - pivot[0]) * math.cos(angle)) - ((point[1] - pivot[1]) * math.sin(angle)) + pivot[0]
    y = ((point[0] - pivot[0]) * math.sin(angle)) + ((point[1] - pivot[1]) * math.cos(angle)) + pivot[1]
    return (x, y)


def line_intersection(line1, line2):
    xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
    ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])

    def det(a, b):
        return a[0] * b[1] - a[1] * b[0]

    div = det(xdiff, ydiff)
    if div == 0:
       raise Exception('lines do not intersect')

    d = (det(*line1), det(*line2))
    x = det(d, xdiff) / div
    y = det(d, ydiff) / div
    return (x, y)


class workspace():
    def __init__(self, __origin=(0,0), __width=1000, __height=1000):
        self.origin = __origin
        self.width = __width
        self.height = __height
        self.objects = []

    def add_object(self, __object):
        self.objects.append(__object)
        # Should I sort this?


class polygon():
    def __init__(self, __origin, __sides, __radius, __kerf=kerf):
        self.kerf = __kerf
        self.sides = __sides
        # kerf parameter
        self.radius = __radius + self.kerf
        self.origin = __origin
        self.points = []
        self.vectors = []
        self.angle = 360/self.sides
        self.make()
        self.get_vectors()

    def make(self):
        for side in range(0, self.sides):
            __x = self.origin[0] + self.radius * math.cos(2 * math.pi * side / self.sides)
            __y = self.origin[1] + self.radius * math.sin(2 * math.pi * side / self.sides)
            self.points.append((__x, __y))

    def get_vectors(self):
        self.vectors = list(zip(self.points, self.points[1:] + self.points[:1]))

    def slot(self, __width, __depth):

        # kerf parameter
        width = __width - self.kerf
        depth = __depth - self.kerf
        # Define points of slot shape:
        __a = (self.origin[0] + self.radius - depth, self.origin[1] - (width / 2))
        __b = (self.origin[0] + self.radius - depth, self.origin[1] + (width / 2))
        __c = (self.origin[0] + self.radius, self.origin[1] + (width / 2))
        __d = (self.origin[0] + self.radius, self.origin[1] - (width / 2))

        # Set initial position rotate to initial position
        __a = rotate_point(__a, self.origin, math.radians(self.angle / 2))
        __b = rotate_point(__b, self.origin, math.radians(self.angle / 2))
        __c = rotate_point(__c, self.origin, math.radians(self.angle / 2))
        __d = rotate_point(__d, self.origin, math.radians(self.angle / 2))

        # packing slot sides
        slot_left_side_1 = (__b, __c)
        slot_right_side_1 = (__a, __d)

        # finding intersection point between slot sides and polygon face 1
        right_inter = line_intersection(self.vectors[0], slot_right_side_1)
        left_inter = line_intersection(self.vectors[0], slot_left_side_1)

        # Manually ordering the points of the slot shape
        output = [self.points[0]]
        output.append(right_inter)
        output.append(__a)
        output.append(__a)
        output.append(__b)
        output.append(__b)
        output.append(left_inter)
        # index 7

        # repeating the process radially for the number of faces.
        for side in range(1, self.sides):
            output.append(rotate_point(self.points[0], self.origin, math.radians(side * self.angle)))
            output.append(rotate_point(right_inter, self.origin, math.radians(side * self.angle)))
            output.append(rotate_point(__a, self.origin, math.radians(side *self.angle)))
            output.append(rotate_point(__a, self.origin, math.radians(side *self.angle)))
            output.append(rotate_point(__b, self.origin, math.radians(side *self.angle)))
            output.append(rotate_point(__b, self.origin, math.radians(side *self.angle)))
            output.append(rotate_point(left_inter, self.origin, math.radians(side * self.angle)))

        # creating a vector list from the points list
        self.output = list(zip(output, output[1:] + output[:1]))


# program test

# creating a random generated polygon
a = polygon(origin, sides, radius)
a.slot(material_thickness, slot_depth)

# creating a DXF document and adding slot output vectors
dxf_file_ = dxf_file("test.dxf")
a.get_vectors()
dxf_file_.add_vectors_dxf(a.output)
# install the base app
git clone https://github.com/nodenv/nodenv.git ~/.nodenv

# add nodenv to system wide bin dir to allow executing it everywhere
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv

# compile dynamic bash extension to speed up nodenv - this can safely fail
cd ~/.nodenv
src/configure && make -C src || true
cd ~/

# install plugins
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases

# install a node version to bootstrap shims
nodenv install 14.7.0
nodenv global 14

# make shims available system wide
sudo ln -vs $HOME/.nodenv/shims/* /usr/local/bin/

# make sure everything is working
node --version
npm --version
npx --version
import java.util.*;
import java.io.*;   

public class MyClass{
  public static void main(String[] args){
    
  }
}
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
$('.showme').click(function(){
$(this).closest('.elementor-section').next().slideToggle();
$(this).toggleClass('opened');
});
$('.closebutton').click(function(){
$(this).closest('.elementor-section').prev().find('.showme').click();
});
});
});
</script>
<style>
.showme a , .showme i , .showme img, .closebutton a, .closebutton i, .closebutton img{
cursor: pointer;
-webkit-transition: transform 0.34s ease;
transition : transform 0.34s ease;
}
.opened i , .opened img , .opened svg{
transform: rotate(90deg);
}
</style>
public int[] topKFrequent(int[] nums, int k) {
        ArrayList<LinkedList<Integer>> freqList = new ArrayList<>();
        for (int i = 0; i <= nums.length; i++) {
            freqList.add(new LinkedList<Integer>());
        }
        
        HashMap<Integer, Integer> elementFreq = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (elementFreq.containsKey(nums[i])){
                elementFreq.put(nums[i], elementFreq.get(nums[i]) + 1);
            }
            else {
                elementFreq.put(nums[i], 1);
            }
        }
        
        Iterator<Integer> elemItr = elementFreq.keySet().iterator();
        while (elemItr.hasNext()) {
            int currKey = elemItr.next();
            freqList.get(elementFreq.get(currKey)).add(currKey);
        }
        
        ArrayList<Integer> intsByFreq = new ArrayList<>();
        for (int i = 0; i < freqList.size(); i++) {            
            LinkedList<Integer> currList = freqList.get(i);
            ListIterator<Integer> currListItr = currList.listIterator(0);
            while (currListItr.hasNext()) {
                intsByFreq.add(currListItr.next());
            }
        }
        
        int[] topK = new int[k];
        int topKIdx = 0;
        for (int i = intsByFreq.size() - 1; i >= intsByFreq.size() - k; i--) {
            topK[topKIdx] = intsByFreq.get(i);
            topKIdx++;
        }
        
        return topK;
    }
split_col = pyspark.sql.functions.split(df['my_str_col'], '-')
df = df.withColumn('NAME1', split_col.getItem(0))
df = df.withColumn('NAME2', split_col.getItem(1))
// Get path to resource on disk
 const onDiskPath = vscode.Uri.file( 
   path.join(context.extensionPath, 'css', 'style.css')
);
// And get the special URI to use with the webview
const cssURI = panel.webview.asWebviewUri(onDiskPath);
select * 
from folder f
  join uploads u ON u.id = f.folderId 
where '8' = ANY (string_to_array(some_column,','))
Top 15 free Handbooks about Data Science / AI :

✅"Data Mining and Analysis":
https://lnkd.in/g2aAhzu

✅"Introduction to Data Science"
https://lnkd.in/gjv-vK5

✅"Python Data Science Handbook"
https://lnkd.in/gxcW3Ku

✅"Learning Pandas"
https://lnkd.in/gP6PYE2

✅"MACHINE LEARNING YEARNING"
https://lnkd.in/gXdYjzi

✅"Feature Engineering for Machine Learning"
https://lnkd.in/gVCGgEN

✅"The Hundred-Page Machine Learning Book"
https://lnkd.in/gNb22Qh

✅ "Introduction to Statistical Machine Learning"
https://lnkd.in/guFgpXD

✅"Statistics for Data Science"
https://lnkd.in/gBudWsA

✅"Natural Language Processing With Python"
https://lnkd.in/gCFKZAs

✅"The Deep Learning Textbook"
https://lnkd.in/gfBv4h5

✅ 600+ Q&As about: Stats, Python, Machine Learning, Deep Learning, NLP, CV
https://lnkd.in/gevhVrZ

✅A Comprehensive Guide to Machine Learning
https://lnkd.in/gAup7nA

✅ Dive into Deep Learning:
https://lnkd.in/gGu5uxW

✅Deep learning Masterpiece by Andrew Ng
https://lnkd.in/gU98mhj

✅Learning SQL:
https://lnkd.in/g5MGAv4
//You need this because ur velocity is in localSpace
//This works if you start the game at 0,0,0 rotation,
//what if you start the game at 0,180,0 rotation?  
//Then your up arrow will move you backwards.


//Get inputs
float horzInput = Input.GetAxis("Horizontal");
float vertInput = Input.GetAxis("Vertical");

//Calc Velocity
Vector3 direction = new Vector3(horzInput, 0.0f, vertInput);
Vector3 velocity = direction * _speed;

//Gravity
velocity.y -= _gravity;

//Convert localSpace velocity to worldSpace
velocity = transform.transform.TransformDirection(velocity); //<-Weimberger's way
velocity = transform.TransformDirection(velocity); //<-myWay

//Move
_controller.Move(velocity * Time.deltaTime);
<picture>
  <source media="(max-width: 799px)" srcset="elva-480w.jpg">
  <source media="(min-width: 800px)" srcset="elva-800w.jpg">
  <img src="elva-800w.jpg">
</picture>
<script>
jQuery( document ).ready(function($){
	$(document).on('click','.elementor-location-popup a', function(event){
		elementorProFrontend.modules.popup.closePopup( {}, event);
	})
});
</script>
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool  isConsecutiveFour(int values[][7]) {

    // checking rows
    for (int i = 0; i < 6; i++) {
       
        int current = values[i][0];
        int consecutiveCount = 0; // values[i][0] starts count

        for (int j = 0; j < 7; j++) {
            
            if (values[i][j] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                current = values[i][j];
                consecutiveCount = 1;
            }
        }
    }
    // check columns
    for (int j = 0; j < 7; j++) {
        
        int consecutiveCount = 0; // values[0][j] starts count
        int current = values[0][j];

        for (int i = 0; i < 6; i++) {

            if (values[i][j] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                current = values[i][j];
                consecutiveCount = 1;
            }

        }
    }

    // check topLeft side: going upright
    for (int i = 6 - 1; i > 0; i--) {
        int y = i;
        int x = 0;
        int consecutive = 0;
        int current = values[y][x];

        while (y >= 0) {
           
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x++;
            y--;
        }
    }

    // check bottom right side: going upright
    for (int j = 0; j < 7; j++) {
        int y = 6 - 1;
        int x = j;
        int consecutive = 0;
        int current = values[y][x];

        while (x < 6 && y >= 0) {
            
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x++;
            y--;
        }

    }

    // check bottom left side going up-left
    for (int j = 7 - 1; j > 0; j--) {

        int x = j;
        int y = 6 - 1;
        int current = values[y][x];
        int consecutiveCount = 0;

        while (x >= 0 && y >= 0) {

            if (values[y][x] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                consecutiveCount = 1;
                current = values[y][x];
            }

            x--;
            y--;
        }
    }
    // check bottom right side going up-left
    for (int row = 1; row < 6; row++) {
        int x = 7 - 1;
        int y = row;
        int consecutive = 0;
        int current = values[y][x];

        while (y >= 0) {
            
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x--;
            y--;
        }

    }
    return false;
}






// Driver code
int main()
{
    int m[6][7];
    for (int i = 0; i < 6; i++)
        for (int j = 0; j < 7; j++)
            cin >> m[i][j];
    if (isConsecutiveFour(m) == true)
        cout << "true";
    else 
        cout << "false";
  
}
# Git Commands

## git init
initialize git and create a new local repository

## git add .
track all the files in the local repo for changes

## git add filename
track a specific file in the repo for changes

## git commit -m "first commit" -m "the description"
take a snapshot of the files in the repo

## git status
check the status of your code

## git remote add origin https-link
add a new remote repository

## git push origin master
push the local repository to github

## git push -u origin master
push the local repository to github and also set upstream (enables you to use git push only in future)

## git branch
check the current branch and available branches

## git checkout -b new-branch-name
go to another new branch

## git checkout existing-branch
switch to an existing branch

## git diff feature
see the difference between files you want to merge

## git config --global user.name "[name]"
Sets the name you want attached to your commit transactions

## git config --global user.email "[email address]"
Sets the email you want attached to your commit transactions

## git config --global color.ui auto
Enables helpful colorization of command line output

## git push
use this cmd when pushing a new branch to see how it should be done

## git pull
when upstream is set , to pull from github when changes made on the github and want them to reflect on local machine

## git pull origin master
to pull from github when changes made on the github and want them to reflect on local machine

## git branch -d branch-name
delete a branch

## git commit -am "message"
commit and add at the same time
@inject HttpClient httpClient

@if (States != null)
{

<select id="SearchStateId" name="stateId" @onchange="DoStuff" class="form-control1">
    <option>@InitialText</option>
    @foreach (var state in States)
    {
        <option value="@state.Name">@state.Name</option>
    }
</select>
}


@code {
[Parameter] public string InitialText { get; set; } = "Select State";
private KeyValue[] States;
private string selectedString { get; set; }
protected override async Task OnInitializedAsync()
{
    States = await httpClient.GetJsonAsync<KeyValue[]>("/sample-data/State.json");
}

private void DoStuff(ChangeEventArgs e)
{
    selectedString = e.Value.ToString();
    Console.WriteLine("It is definitely: " + selectedString);
}

public class KeyValue
{
    public int Id { get; set; }

    public string Name { get; set; }
}
}
#include<iostream>
using namespace std;

int sum(int arr[], int a);

int main() {
    int arr[1000], n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        cout << sum(arr, n);
    }
}
int sum(int arr[], int a) {
    int i;
    sum = 0;
    for (i=0; i<n; ++i) {
        sum += arr[i];
    }
    return sum;
}#include<iostream>
using namespace std;

int sum(int arr[], int a);

int main() {
    int arr[1000], n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        cout << sum(arr, n);
    }
}
int sum(int arr[], int a) {
    int i;
    sum = 0;
    for (i=0; i<n; ++i) {
        sum += arr[i];
    }
    return sum;
}
Integer year = 2021, mon=02, day=12, hour=23, min=50;

Datetime dtGMT = Datetime.newInstanceGMT(year, mon, day, hour, min, 0);

String exTimezone = 'America/Los_Angeles';
String dateTimeForamat = 'yyyy-MM-dd HH:mm:ssz';
String schedulerFormat = 'mm:HH:dd:MM:yyyy';
String crnTemplate = '0 {0} {1} {2} {3} ? {4}';

String localFromatted = dtGMT.format(dateTimeForamat, UserInfo.getTimeZone().getId());
String exFormatted = dtGMT.format(dateTimeForamat, exTimezone);

Datetime localDTValueGMT = Datetime.valueOfGMT(localFromatted);
Datetime exDTVaueGMT = Datetime.valueOfGMT(exFormatted);

Integer minDiff = (Integer)(localDTValueGMT.getTime() - exDTVaueGMT.getTime())/60000;

Datetime scheduleDTGMT = dtGMT.addMinutes(minDiff + 15);

String schFormmated = scheduleDTGMT.formatGMT(schedulerFormat);

String cronExp = String.format(crnTemplate, schFormmated.split(':'));

System.debug('dtGMT : ' + JSON.serialize(dtGMT));
System.debug('localDTValueGMT : ' + JSON.serialize(localDTValueGMT));
System.debug('exDTVaueGMT : ' + JSON.serialize(exDTVaueGMT));
System.debug('scheduleDTGMT : ' + JSON.serialize(scheduleDTGMT));
System.debug('cronExp: ' + cronExp);
  class MyBlinkingButton extends StatefulWidget {
    @override
    _MyBlinkingButtonState createState() => _MyBlinkingButtonState();
  }

  class _MyBlinkingButtonState extends State<MyBlinkingButton>
      with SingleTickerProviderStateMixin {
    AnimationController _animationController;

    @override
    void initState() {
      _animationController =
          new AnimationController(vsync: this, duration: Duration(seconds: 1));
      _animationController.repeat(reverse: true);
      super.initState();
    }

    @override
    Widget build(BuildContext context) {
      return FadeTransition(
        opacity: _animationController,
        child: MaterialButton(
          onPressed: () => null,
          child: Text("Text button"),
          color: Colors.green,
        ),
      );
    }

    @override
    void dispose() {
      _animationController.dispose();
      super.dispose();
    }
  }
playList.setOnMouseClicked(new EventHandler<MouseEvent>() {

    @Override
    public void handle(MouseEvent click) {

        if (click.getClickCount() == 2) {
           //Use ListView's getSelected Item
           currentItemSelected = playList.getSelectionModel()
                                                    .getSelectedItem();
           //use this to do whatever you want to. Open Link etc.
        }
    }
});
<?php
	session_start();
	
	$errorsArr = array();
	
	if(isset($_POST['submittedLogin'])){
		$username = $_POST['usernameLogin'];
		$password = $_POST['passwordLogin'];
		
		//ensure form fields are filled properly
		if(empty($username)){
			array_push($errorsArr, "Username is required! Please try again!");
		}
		if(empty($password)){
			array_push($errorsArr, "Password is required! Please try again!");
		}
		if((!empty($username)) && (!empty($password)) && ($username != 'admin') && ($password != 'admin')){
			array_push($errorsArr, "Incorrect username or password! Please try again!");
		}
		
		//no errors
		if(count($errorsArr) == 0){
			$_SESSION['username'] = $username;
			$_SESSION['success'] = "You are now logged in!";
			header('Location: /205CDE/Assignment/manageNews.php');
		}
	}
	
	//logout
	if(isset($_GET['logout'])){
		session_destroy();
		unset($_SESSION['username']);
		header('Location: /205CDE/Assignment/home.php');
	}
?>
<div class="container-fluid" style="background: #1f52a3;">
	<div class="row">
		<div class="col-2"></div>
		<div class="col-8">
			<a href="/205CDE/Assignment/home.php"><h1 style="text-align: center; color: #e6e8eb; margin: 20px 0;">U Chen Daily</h1></a>
		</div>
		<div class="col-2 d-flex justify-content-center align-items-center">
			<?php if(isset($_SESSION['username'])){ ?>
				<a href="/205CDE/Assignment/home.php?logout='1'" class="btn btn-outline-light">LOGOUT</a>
				<?php }else{ 
				?>
				<button type="button" class="btn btn-outline-light" data-toggle="modal" data-target="#loginFormModal">
					LOGIN AS ADMIN
				</button>
			<?php } ?>
			<!--<a href="/205CDE/Assignment/manageNews.php" target="_blank" class="btn btn-outline-light">LOGIN</a>-->
		</div>
	</div>
</div>
<!--login form modal START-->
<!-- Modal -->
<div class="modal fade" id="loginFormModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="exampleModalCenterTitle">Login</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form action="/205CDE/Assignment/home.php" method="post" id="loginModalForm">
				<div class="modal-body">
					<?php
						if(count($errorsArr) > 0){?>
						<div class="form-group">
							<?php
								foreach($errorsArr as $errorMsg){
									//echo "<p class=\"text-danger\">$errorMsg</p>";
									echo "<script>alert(\"$errorMsg\")</script>";
								}
							?>
						</div>
						<?php }
					?>
					<div class="form-group">
						<label for="exampleInputEmail1">Username</label>
						<input type="text" class="form-control" name="usernameLogin" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter username" value="<?php if(isset($username)){echo $username;} ?>">
					</div>
					<div class="form-group">
						<label for="exampleInputPassword1">Password</label>
						<input type="password" class="form-control" name="passwordLogin" id="exampleInputPassword1" placeholder="Enter password">
					</div>
					<br>
					<div class="form-group">
						<button type="submit" class="btn btn-lg btn-block text-light" style="background: #1f52a3;">LOGIN</button>
						<input type="hidden" name="submittedLogin">
					</div>
				</div>
				<!--<div class="modal-footer">
					<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
					<button type="button" class="btn btn-primary">Login</button>
				</div>-->
			</form>
		</div>
	</div>
</div>
<!--login form modal END-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
	<a class="navbar-brand" href="/205CDE/Assignment/home.php"><i class="fas fa-home" style="font-size: 30px; color: #1f52a3;"></i></a>
	<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
		<span class="navbar-toggler-icon"></span>
	</button>
	
	<div class="collapse navbar-collapse" id="navbarSupportedContent">
		<ul class="navbar-nav mr-auto">
			<li class="nav-item dropdown" style="margin: 0 15px;">
				<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">News</a>
				<div class="dropdown-menu" aria-labelledby="navbarDropdown">
					<?php
						$newsCategoryArr = array(
						'All', 'Nation', 'World',
						'Sport', 'Entertainment',
						);
						foreach($newsCategoryArr as $newsType){
							echo "<a class=\"dropdown-item\" href=\"/205CDE/Assignment/news$newsType.php\" target=\"_blank\">$newsType</a>";
						}
					?>
				</div>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/aboutUs.php" target="_blank">About Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/contactUs.php" target="_blank">Contact Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/faqs.php" target="_blank">FAQs</a>
			</li>
			<!-- <li class="nav-item"> -->
			<!-- <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> -->
			<!-- </li> -->
		</ul>
		<!-- <form class="form-inline my-2 my-lg-0"> -->
		<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> -->
		<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> -->
		<!-- </form> -->
	</div>
</nav>
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
# 复制到网盘,并显示实时传输进度,设置并行上传数为8

rclone copy -P /home/SunPma GD:/home/SunPma --transfers=8

# 如果需要服务端对服务端的传输可加以下参数(不消耗本地流量)

rclone copy 配置名称:网盘路径 配置名称:网盘路径 --drive-server-side-across-configs
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	cout << "enter the year ";
	int year;
	cin >> year;
	
	cout << "Enter The First Day Of The year ";
	int FirstDay;
	cin >> FirstDay;
	int count = 1;
	int days = 1;
	for (int month = 1; month <= 12; month++)
	{
		cout << "             ";
		switch (month)
		{
		case 1: cout << "January " << year<<endl;
			break;
		case 2: cout << "February " << year << endl;
			break;
		case 3: cout << "March  " << year << endl;
			break;
		case 4: cout << "April  " << year << endl;
			break;
		case 5: cout << "May " << year << endl;
			break;
		case 6: cout << "June  " << year << endl;
			break;
		case 7: cout << "July  " << year << endl;
			break;
		case 8: cout << "August " << year << endl;
			break;
		case 9: cout << "September " << year << endl;
			break;
		case 10: cout << "October " << year << endl;
			break;
		case 11: cout << "November " << year << endl;
			break;
		case 12: cout << "December " << year << endl;
			break;
		}
		cout << " --------------------------------------------------------- "<<endl;
		cout << "  Sun Mon Tue Wed Thu Fri Sat"<<endl;
		for (int i = 0; i < FirstDay; i++)
		{
			cout << "    ";
		}
		for (int i = 1; i < 31; i++)
		{
			if (i < 10) {
				cout<<"   " <<i;
			}
			else {
				cout<<"  " << i;
			}
			if ((i + FirstDay) % 7 == 0) {
				cout << endl;
			}
		}
		cout << endl;

		FirstDay = (FirstDay + 31) % 7;
		
	}
	
	
}

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	cout << "enter the month ";
	int month;
	cin >> month;
	cout << "Enter The First Day Of The Month ";
	int firstDay;
	cin >> firstDay;
	int nextSunday = 1;
	
		switch (firstDay)
		{
			
		case 1: nextSunday += 7;
			cout << "The first day of this month is sunday "<<endl;
			while (nextSunday < 30)
			{
					cout << "Next Sunday of this month is on " << nextSunday << endl;
									nextSunday += 7 ;
			}
			break;

		case 2: nextSunday += 6;
			cout << "The first day of this month is monday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 3: nextSunday += 5;
			cout << "The first day of this month is tuesday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 4: nextSunday += 4;
			cout << "The first day of this month is wednesday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 5: nextSunday += 3;
			cout << "The first dayof this month is thursday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 6: nextSunday += 2;
			cout << "The first day of this month is friday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 7: nextSunday += 1;
			cout << "The first day of this month is saturday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;

		}
		
}

	
	

- git init         #Initialise locat repositiry
- git add <file>   #Add files to index
- git status       #Check status of working tree
- git commit       #Commit changes in index
- git push         #Push to remote repository
- git pull         #Pull latest from remote repository
- git clone        #Clone repository into a new directory
##-----------------------------------------------------------------------------
1. Configure
- git config --global user.name 'Ian Horne'
- git config --global user.email 'ian@ihorne.com'
##-----------------------------------------------------------------------------
2. File to staging
- git add <file name> #Add file 
- git rm <file name>  #Remove file
- git add *.py        #Add all .py files to staging area
- git add .           #Add all files in directory to staging area
##-----------------------------------------------------------------------------
3. Commit staging area to your local repository
- git commit -m "your comments"
##-----------------------------------------------------------------------------
4. Ignore file
- create .git ignore file <touch .gitignore> 
- enter file or folder into .gitignore file to exclude it from the repository 
   -Add file           - <file.ext>
   -Add directory      - </dirname> 
   -Add all text files - <*.txt>
##-----------------------------------------------------------------------------
5. Branches - https://www.atlassian.com/git/tutorials/using-branches
- git branch <branch_name>    #Create branch
- git checkout <branch_name>  #move to branch
- git add <filename>          #add file change to branches
- git commit -m "comments"    #commit file and add comments
- git checkout <master>       #move to main branch
- git merge <branch name>     #merge branch into current branch location
- git push                    #push branch to hub
- git branch -d <branch>      #delete branch

##-----------------------------------------------------------------------------
6. Remove repositories
- Create new repository
- git remote                #list all remote repositories
- git remote add origin https://github.com/Ianhorne73/WageReport.git
- git push -u origin master
##-----------------------------------------------------------------------------
Future workflow
- change file
- git add .
- git push
##-----------------------------------------------------------------------------
Clone repository 
- git clone <get link from GIT hub>  #Clone repository from GIT Hub
- git pull                           #Get latest updates
virtualenv env

# linux
source env/bin/activate

#windows
env\Scripts\activate.bat

deactivate
>>> mydict = {'one': [1,2,3], 2: [4,5,6,7], 3: 8}

>>> dict_df = pd.DataFrame({ key:pd.Series(value) for key, value in mydict.items() })

>>> dict_df

   one  2    3
0  1.0  4  8.0
1  2.0  5  NaN
2  3.0  6  NaN
3  NaN  7  NaN
const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
  const { top, left, bottom, right } = el.getBoundingClientRect();
  const { innerHeight, innerWidth } = window;
  return partiallyVisible
    ? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
        ((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
    : top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
};

// Examples
elementIsVisibleInViewport(el); // (not fully visible)
elementIsVisibleInViewport(el, true); // (partially visible)
df.set_index(KEY).to_dict()[VALUE]

3 ways:
dict(zip(df.A,df.B))
pd.Series(df.A.values,index=df.B).to_dict()
df.set_index('A').to_dict()['B']
class ChangeDefaultvalueForHideSeasonSelector < ActiveRecord::Migration 
  def change 
    change_column_default :plussites, :hide_season_selector, true 
  end
end
function validateEmail(email) 
    {
        var re = /\S+@\S+\.\S+/;
        return re.test(email);
    }
    
console.log(validateEmail('anystring@anystring.anystring'));
Escapes or unescapes a JSON string removing traces of offending characters that could prevent parsing.

The following characters are reserved in JSON and must be properly escaped to be used in strings:

Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Tab is replaced with \t
Double quote is replaced with \"
Backslash is replaced with \\
const AWS = require('aws-sdk')

// Configure client for use with Spaces
const spacesEndpoint = new AWS.Endpoint('nyc3.digitaloceanspaces.com');
const s3 = new AWS.S3({
    endpoint: spacesEndpoint,
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRET_KEY'
});

// Add a file to a Space
var params = {
    Body: "The contents of the file",
    Bucket: "my-new-space-with-a-unique-name",
    Key: "file.ext",
};

s3.putObject(params, function(err, data) {
    if (err) console.log(err, err.stack);
    else     console.log(data);
});
document.querySelectorAll('img')
    .forEach((img) =>
        img.addEventListener('load', () =>
            AOS.refresh()
        )
    );
<div class="container h-100">
    <div class="row align-items-center h-100">
        <div class="col-6 mx-auto">
            <div class="jumbotron">
                I'm vertically centered
            </div>
        </div>
    </div>
</div>
$(window).bind("pageshow", function() {
    var form = $('form'); 
    // let the browser natively reset defaults
    form[0].reset();
});
$("#slideshow > div:gt(0)").hide();

setInterval(function() { 
  $('#slideshow > div:first')
    .fadeOut(1000)
    .next()
    .fadeIn(1000)
    .end()
    .appendTo('#slideshow');
},  3000);
V3D predictedRPY = qt.ToEulerRPY();
float predictedRoll = predictedRPY.x;
float predictedPitch = predictedRPY.y;
ekfState(6) = (float)predictedRPY.z; // yaw
star

Wed Mar 10 2021 06:29:56 GMT+0000 (Coordinated Universal Time) https://github.com/CMB2/CMB2/wiki/Basic-Usage

@francis_cubi #php

star

Tue Mar 09 2021 15:03:14 GMT+0000 (Coordinated Universal Time) https://codepen.io/u_conor/pen/rweqyW

@mishka #javascript

star

Tue Mar 09 2021 14:34:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/36460874/laravel-5-errorexception-failed-to-open-stream-permission-denied

@hassanms #laravel

star

Sat Mar 06 2021 20:42:30 GMT+0000 (Coordinated Universal Time) http://fabacademy.org/2021/labs/agrilab/students/antonio-anaya/assignments/week04/

@kny5 #python #geometry #fabacademy #week04 #2021

star

Fri Mar 05 2021 21:30:08 GMT+0000 (Coordinated Universal Time) https://gist.dreamtobe.cn/mrbar42/faa10a68e32a40c2363aed5e150d68da

@faisalhumayun

star

Wed Mar 03 2021 19:37:38 GMT+0000 (Coordinated Universal Time) https://laravelarticle.com/laravel-barcode-tutorial

@fadas

star

Mon Mar 01 2021 10:25:04 GMT+0000 (Coordinated Universal Time)

@furqaan #java

star

Fri Feb 26 2021 11:47:21 GMT+0000 (Coordinated Universal Time) https://element.how/elementor-show-hide-section/

@PFMC

star

Wed Feb 24 2021 22:35:52 GMT+0000 (Coordinated Universal Time)

#java
star

Wed Feb 24 2021 17:36:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39235704/split-spark-dataframe-string-column-into-multiple-columns

@lorenzo_xcv #pyspark #spark #python #etl

star

Sat Feb 06 2021 13:14:41 GMT+0000 (Coordinated Universal Time) https://mishka.codes/webviews-in-vscode

@mishka #typescript

star

Tue Feb 02 2021 18:00:05 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/35169412/mysql-find-in-set-equivalent-to-postgresql

@mvieira #sql

star

Tue Feb 02 2021 12:11:10 GMT+0000 (Coordinated Universal Time) https://github.com/blockstack/app-mining/pull/44

@cryptpkr

star

Fri Jan 29 2021 19:18:47 GMT+0000 (Coordinated Universal Time)

@edwardga

star

Sat Jan 23 2021 13:06:59 GMT+0000 (Coordinated Universal Time)

@cotterdev #c#

star

Fri Jan 22 2021 13:05:25 GMT+0000 (Coordinated Universal Time) https://codepen.io/marcobiedermann/pen/WNGWzYR

@bifrost #css #react.js

star

Thu Jan 21 2021 20:06:06 GMT+0000 (Coordinated Universal Time)

@abovetheroar #qgis #fieldcalculator

star

Sun Jan 17 2021 21:29:18 GMT+0000 (Coordinated Universal Time) https://medium.com/free-code-camp/time-saving-css-techniques-to-create-responsive-images-ebb1e84f90d5

@orlando

star

Fri Jan 01 2021 08:33:58 GMT+0000 (Coordinated Universal Time)

@lewiseman

star

Wed Dec 30 2020 19:26:24 GMT+0000 (Coordinated Universal Time)

@lewiseman #django,python,django #django

star

Tue Dec 29 2020 03:43:48 GMT+0000 (Coordinated Universal Time) https://blazor-tutorial.net/knowledge-base/49947790/blazor-onchange-event-with-select-dropdown

@justoshow #blazor #c# #html

star

Mon Dec 28 2020 03:44:59 GMT+0000 (Coordinated Universal Time)

@CnnThjin #c++

star

Wed Dec 16 2020 17:34:22 GMT+0000 (Coordinated Universal Time)

@santoshduvvuri #apex #datetime

star

Fri Dec 04 2020 20:33:23 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/51733044/flutter-blinking-button

@Kenana #dart

star

Thu Dec 03 2020 16:35:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/22542015/how-to-add-a-mouse-doubleclick-event-listener-to-the-cells-of-a-listview-in-java

@jasoncriss

star

Sun Nov 29 2020 16:44:07 GMT+0000 (Coordinated Universal Time) https://forums.docker.com/t/start-a-gui-application-as-root-in-a-ubuntu-container/17069

@MathLaci08 #bash #docker #ubuntu

star

Wed Nov 25 2020 14:39:33 GMT+0000 (Coordinated Universal Time)

@uchenliew #php

star

Mon Nov 16 2020 14:22:51 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@ali_alaraby #typescript

star

Tue Nov 10 2020 07:16:25 GMT+0000 (Coordinated Universal Time) https://www.codegrepper.com/code-examples/javascript/add+property+to+object+javascript+using+".map()"

@ali_alaraby #undefined

star

Mon Nov 02 2020 08:47:35 GMT+0000 (Coordinated Universal Time)

@natsumi88

star

Sat Oct 31 2020 08:17:41 GMT+0000 (Coordinated Universal Time) https://sunpma.com/864.html

@natsumi88

star

Mon Oct 26 2020 04:28:26 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=SWYqp7iY_Tc

@ianh #git

star

Thu Oct 22 2020 14:28:39 GMT+0000 (Coordinated Universal Time) https://realpython.com/python-virtual-environments-a-primer/

@ak1957 #python #virtual_environment #virtalenv

star

Sun Oct 18 2020 16:45:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/19736080/creating-dataframe-from-a-dictionary-where-entries-have-different-lengths

@arielvol #python

star

Mon Oct 12 2020 04:19:11 GMT+0000 (Coordinated Universal Time) https://madza.hashnode.dev/24-modern-es6-code-snippets-to-solve-practical-js-problems?guid

@mulitate4

star

Fri Oct 09 2020 23:33:40 GMT+0000 (Coordinated Universal Time) https://github.com/BrainJS/brain.js

@robertjbass

star

Thu Aug 27 2020 19:54:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/17426292/what-is-the-most-efficient-way-to-create-a-dictionary-of-two-pandas-dataframe-co

@arielvol #python

star

Thu Aug 27 2020 16:52:41 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42668391/change-the-default-value-for-table-column-with-migration

@ludaley #rb

star

Wed Aug 19 2020 15:26:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript

@rdemo #javascript

star

Mon Aug 17 2020 21:58:29 GMT+0000 (Coordinated Universal Time) https://www.freeformatter.com/json-escape.html

@Ohad #json

star

Sat Aug 08 2020 04:44:29 GMT+0000 (Coordinated Universal Time) https://www.digitalocean.com/community/questions/can-i-upload-images-to-spaces-using-node-js

@rdemo

star

Sat Jul 25 2020 00:48:18 GMT+0000 (Coordinated Universal Time)

@johannalexander #javascript

star

Mon Jun 29 2020 07:34:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42252443/vertical-align-center-in-bootstrap-4

@peota

star

Sun Jun 28 2020 10:47:01 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/8861181/clear-all-fields-in-a-form-upon-going-back-with-browser-back-button

@mishka #jquery

star

Tue Jun 23 2020 09:27:41 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/

@Amna #javascript #jquery

star

Mon Jun 22 2020 19:57:38 GMT+0000 (Coordinated Universal Time) https://medium.com/building-autonomous-flight-software/the-math-behind-state-estimation-in-aerospace-software-66a15761049c

@arush

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension