This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wrapLog = function (callback, name) { | |
//var args = callback.apply(null,arguments); | |
//console.log(arguments); | |
//console.log(args); | |
//console.log(arguments[0]); | |
//console.log(arguments); | |
return function() { | |
//console.log(arguments); | |
//console.log(callback.apply(null,arguments)); | |
//var arg2 = 1, arg1 = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import csv | |
import datetime | |
import timeit | |
import pandas as pd | |
import pickle | |
flcount = 0 | |
addcount = 0 | |
lastadded = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from resizeimage import resizeimage | |
import os | |
dir = 'C:\Users\chouw\Documents\pictures' | |
for dirname,subdirlist,flist in os.walk(dir): | |
for fname in flist: | |
if fname.lower().endswith('.jpg'): | |
if os.stat(dir+"\\"+fname).st_size > 3000: | |
print "resize {}".format(fname), | |
with open(dir+"\\"+fname, 'r+b') as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import os | |
import datetime | |
import numpy as np | |
#This will be the directory with all the sheets to combine. | |
questdir = 'C:\Users\chouw\Desktop\Load3' | |
#chunk of code to verify file count matches. | |
files = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.tweets.findAndModify({query: {"likes" : null},update:{$set: {"likes": []}},new: true, upsert: true }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.tweets.updateMany({ {"likes" : null},{$set: {"likes": []}} }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command to insert: | |
r = Rating.create :user_id => 1, :product_id => 1, :description => 'I dont like this shirt', :rating => 2 | |
To run migration: | |
bin/rake db:migrate | |
To create anew migration for adding in reference columns : | |
bin/rails generate migration AddUserAndProductToRatings user:references product:references | |
Create a new model/migration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CheckboxLoop() | |
'Using this as a start: | |
'PURPOSE: Loop through each Form Control Checkbox on the ActiveSheet | |
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault | |
Dim cb As Shape | |
Dim i As Integer | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
echo 'No quotes in single backticks' | |
sh 'echo $BUILD_NUMBER' | |
echo 'Double quotes are silently dropped' | |
sh 'echo "$BUILD_NUMBER"' | |
echo 'Even escaped with a single backslash they are dropped' | |
sh 'echo \"$BUILD_NUMBER\"' | |
echo 'Using two backslashes, the quotes are preserved' | |
sh 'echo \\"$BUILD_NUMBER\\"' | |
echo 'Using three backslashes still results in preserving the single quotes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Avoid annoying immutability bugs by using this nice ES6 deconstructing trick to keep your object immutable. | |
// example obj | |
const someObj = { | |
want: 'this', | |
need: 'that', | |
dont: 'wantthis', | |
forget: 'this' | |
}; |
OlderNewer