Skip to content

Instantly share code, notes, and snippets.

@charandas
charandas / scrolling-fix
Created October 25, 2015 00:20
Chromium svn r201483 git commit hash 1eef74ce70198749800f08cc2623b14f615fb2f0
git tag --contains 1eef74ce70198749800f08cc2623b14f615fb2f0
47.0.2518.0
47.0.2518.1
47.0.2519.0
47.0.2520.0
47.0.2521.0
47.0.2521.1
47.0.2521.2
47.0.2521.3
47.0.2521.4
@charandas
charandas / tryjsil.cs
Created October 14, 2015 17:05
base64 decode
using System;
using System.Text;
using JSIL;
using JSIL.Meta;
public static class Program {
public static int x = 10;
public static int y = 20;
public static void Main () {
@charandas
charandas / keen-js-error.dump
Created September 2, 2015 20:43
keen-js superagent CORS error
Refused to set unsafe header "accept-encoding"Request.end @
Refused to set unsafe header "user-agent"
Refused to set unsafe header "content-length"
XMLHttpRequest cannot load https://api.keen.io/3.0/projects/<project-id>/queries/count. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:5001' is therefore not allowed access.
@charandas
charandas / redshift.desktop
Created September 1, 2015 03:01
Redshift icon instructions - basically a .desktop file placed in ~/.local/share/applications/
[Desktop Entry]
Name=Redshift
Comment=Love your eyes
Exec=redshift-gtk -l 43.64147:-70.24088 -t 5700:3600 -g 0.8 -m randr -v
Icon=/home/charandas/code/redshift/data/icons/hicolor/scalable/apps/redshift.svg
Terminal=false
Type=Application
@charandas
charandas / reshift.sh
Created September 1, 2015 02:56
redshift compile instructions for Ubuntu 15.04
# Some of these you would need to execute as root
apt-get install build-essential libxcb-randr0-dev
apt-get install autopoint
apt-get install autoconf
apt-get install intltool
apt-get install libtool
git clone [email protected]:jonls/redshift.git
cd redshift
@charandas
charandas / subnetSumSpecial.js
Last active November 13, 2015 22:39
Subnet Sum Problem - Special Case where number of constituents of sum is fixed
/*
* Synopsis:
*
* @author: Karan Batra-Daitch
* @license: MIT
*
* This is the famous subnet-sum problem, with the special case on the number
* of elements required to make the sum.
*
* My solution is based off of this quora question/answer
// Given element is an array of jquery elements
var rect = element[0].getBoundingClientRect();
console.dir(rect);
// NOTE: this is how a click can be copy-played again
$(document.elementFromPoint(rect.left, rect.top)).click();
@charandas
charandas / core.js
Last active August 29, 2015 14:07
ui-router and cached services not-so-contrived example
// states/core.js
// raiiServicesExample.states.core module
$stateProvider
.state('app', {
resolve: {
allListings: function(ListingService) {
return ListingService.getAll();
}
}
@charandas
charandas / boot.js
Last active August 29, 2015 14:07
futureStates.addResolve is enough for some of us with ocLazyLoad
define([
'angular',
'angularUiRouter',
'uiRouterExtras',
'uiRouterExtrasStatevis',
'ocLazyLoad',
'boot/module',
'boot/services/settings',
'boot/services/listings'
@charandas
charandas / googletesting.js
Created August 26, 2014 19:28
fetchText returning the casper object through mocha-casperjs
if (typeof chai === 'undefined') {
console.log('This example requires chai to be installed adjacent to mocha-casperjs')
casper.exit(-1)
}
describe('Google searching', function() {
before(function() {
casper.start('http://www.google.fr/')
})