Skip to content

Instantly share code, notes, and snippets.

@evaletolab
evaletolab / javascript.md
Last active December 6, 2016 09:16
javascript.md

Array slice vs splice

this will remove 1 item at index 4.

arr.splice(4, 1)

this will return elements in position 0 through 4.

arr.slice(0,5)

####Instead of using !important, you can use an attribute selector

.input-large[class="input-large"] {
    width: 400px;
}

vertical alignment

Apt

  • find package that belong to file dpkg -S /path/to/file

bash Net

  • find application that listen port 4200 lsof -i :4200

bash replace txt

sed -i -- 's/foo/bar/g' directory/*
find . -type f -exec sed -i 's/foo/bar/g' {} +
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@evaletolab
evaletolab / gist:89fe4bd4307345418113
Last active December 6, 2016 09:19 — forked from mhawksey/gist:1170597
gg.script
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@evaletolab
evaletolab / nginx.conf
Last active December 6, 2016 09:18 — forked from thoop/nginx.conf
nginx.conf
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
#!/usr/bin/node
function luhnMod10 (bvr){
var k, I=0;
var zr_post = "0946827135094682713" ;
for (var J = 0 ; J< bvr.length; J++){
k = parseInt(bvr.charAt(J));
I = parseInt(zr_post.charAt(I+k));
@evaletolab
evaletolab / css.md
Last active April 25, 2019 08:05
css.md

image/content full width

.container {
  max-width:800px;
  width: calc( 100vw - 6rem );
  margin: 0 auto;
}
.image-fullwidth {
 max-width:100vw;
@evaletolab
evaletolab / active.md
Created September 21, 2016 08:21 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Fri, 19 Jun 2015 15:17:38 GMT till Sun, 19 Jun 2016 15:17:38 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 635)