Skip to content

Instantly share code, notes, and snippets.

View JonMidhir's full-sized avatar

John Hope JonMidhir

View GitHub Profile
# I have an list of maps :
sentence_list = [
%{
keywords: ~w(cat),
sentence: "I'm a cat person",
},
%{
keywords: ~w(dog),
sentence: "I'm a dog person",
@toddhgardner
toddhgardner / backbone-trackjs.js
Last active December 28, 2015 10:29
Integrating {Track:js} TrackAll with Backbone.
// OPTION 1:
// Automatically wrap everything
;(function() {
'use strict';
if (!window.trackJs) return;
[ 'View'
, 'Model'
class Shsh.Views.AssetsIndex extends Backbone.View
template: JST['assets/index']
initalize: ->
@collection.on('reset', @render, this)
render: ->
$(@el).html(@template(assets: @collection))
console.log('rendered')
@bazscott
bazscott / Code Snippets for Dash
Created September 18, 2013 19:36
A collection of the code snippets I use in Dash
// ====================================================
// SINGLETON
// ====================================================
+ (__class__ *)__accessor__ {
static dispatch_once_t pred;
static __class__ *__singleton__ = nil;
dispatch_once(&pred, ^{
__singleton__ = [[__class__ alloc] init];
});
@aras-p
aras-p / preprocessor_fun.h
Last active June 12, 2024 00:35
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
$ = jQuery
$.fn.lineHeight or= ->
if height = @data('lineHeight')
return height
# Create a hidden div with the same font
# properties, then measure its height
$shadow = $('<span />')
$shadow.css({
@killercup
killercup / README.md
Created March 16, 2012 11:03
Unicorn, RVM Wrapper, Init.d

You have your Rails Apps with specific Gemsets in RVM.

The following commands creates a wrapped unicorn_rails bin. Be sure to replace the variables and that you have unicorn in your bundle.

rvmsudo rvm wrapper [RUBY VERSION]@[GEMSET] [GEMSET] unicorn_rails

Now you have a /usr/local/rvm/bin/[GEMSET]_unicorn_rails I will refer to [GEMSET]_unicorn_rails as [WRAPPED_NAME]

@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet