Skip to content

Instantly share code, notes, and snippets.

@coldhawaiian
coldhawaiian / Query.js
Created February 26, 2014 03:48
FQL Query Builder: a standalone JavaScript class to dynamically generate Facebook Query Language queries.
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Keoki Zee
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@coldhawaiian
coldhawaiian / jQuerify.html
Last active August 29, 2015 13:56
A bookmarklet for injecting jQuery into any web page (jQuerifying, or jQuerification). Might need to call jQuery.noConflict() if there are problems with $ variable.
<a href="javascript:(function () { var script = document.createElement('script'); script.src = 'https://code.jquery.com/jquery-1.11.0.min.js'; var head = document.getElementsByTagName('head')[0]; head.appendChild(script); })();">
jQuerify
</a>
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@coldhawaiian
coldhawaiian / command.sh
Created February 7, 2014 20:13
Bash command for opening multiple files in your favorite editor
# Example $FILE_PATTERN: '*.js'
find $DIRECTORY -type f -name $FILE_PATTERN -exec $EDITOR "{}" \;

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@coldhawaiian
coldhawaiian / notes.md
Last active January 4, 2016 20:49
AngularJS Scope Notes
// Facebook SDK
angular.module('facebook', [])
.directive('fb', ['$FB', function($FB) {
return {
restrict: "E",
replace: true,
template: "<div id='fb-root'></div>",
compile: function(tElem, tAttrs) {
return {
post: function(scope, iElem, iAttrs, controller) {
/*global requirejs*/
requirejs.config({
shim: {
"bootstrap/js/bootstrap-affix": ["jquery"],
"bootstrap/js/bootstrap-transition": ["bootstrap/js/bootstrap-affix"],
"bootstrap/js/bootstrap-alert": ["bootstrap/js/bootstrap-transition"],
"bootstrap/js/bootstrap-button": ["bootstrap/js/bootstrap-alert"],
"bootstrap/js/bootstrap-collapse": ["bootstrap/js/bootstrap-button"],
"bootstrap/js/bootstrap-dropdown": ["bootstrap/js/bootstrap-collapse"],
"bootstrap/js/bootstrap-modal": ["bootstrap/js/bootstrap-dropdown"],
@coldhawaiian
coldhawaiian / Preferences.sublime-settings
Created January 5, 2014 08:17
Sublime Text 3 User Preferences
{
"auto_indent": true,
"bold_folder_labels": true,
// https://github.com/thinkpixellab/flatland
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"font_face": "Source Code Pro",
"font_size": 14,
"highlight_modified_tabs": true,
"rulers":
[
#include <stdio.h>
int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; }
int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; }
int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; }
int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; }
int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; }
int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; }
int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; }
int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; }