Skip to content

Instantly share code, notes, and snippets.

View tjmehta's full-sized avatar
💭
🌉

Tejesh Mehta tjmehta

💭
🌉
View GitHub Profile
@timoxley
timoxley / view-helper.coffee
Created August 1, 2012 17:02
backbone handlebars helper, allows child views to be initialised from templates ala Ember
Handlebars.registerHelper 'view', (viewPath, options) ->
# use Backbone.View if not supplied a backbone view subclass
unless viewPath
viewPath = 'Backbone.View'
return 'No View'
View = viewPath.split('.').reduce (previous, current) ->
return previous[current]
, window
@mathiasbynens
mathiasbynens / LICENSE.txt
Last active October 5, 2022 10:38 — forked from 140bytes/LICENSE.txt
UTF-8 byte counter in 49 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathias Bynens <http://mathiasbynens.be/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@fieg
fieg / redis-expire.sh
Last active October 10, 2022 23:09
Set expire on large set of keys using pattern in Redis
#!/bin/bash
if [ $# -ne 4 ]
then
echo "Usage: $0 <host> <port> <pattern> <seconds>"
exit 1
fi
cursor=-1
keys=""
@vincentriemer
vincentriemer / Player.jsx
Created April 14, 2019 20:33
Player code for my Apple Music clone
// @flow
import * as React from "react";
import {
View,
StyleSheet,
Image,
Animated,
TouchableOpacity,
Text,
@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@sponomarev
sponomarev / command.sh
Created November 9, 2013 10:43
Remove iTerm2 icon from Dock
# remove
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# restore
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist
@acolyer
acolyer / jessfraz.md
Created November 19, 2017 13:39
Containers, operating systems and other fun things from The Morning Paper
struct CardView: View {
var item: ItemData
var animation: Namespace.ID
var body: some View {
HStack {
Circle()
.frame(width: 75)
.foregroundColor(item.color)
.overlay {
@tjmehta
tjmehta / javascript-object-to-querystring.js
Last active January 28, 2024 22:35
Object to Querystring - JavaScript, JS, JSON
function objectToQuerystring (obj) {
return Object.keys.reduce(function (str, key, i) {
var delimiter, val;
delimiter = (i === 0) ? '?' : '&';
key = encodeURIComponent(key);
val = encodeURIComponent(obj[key]);
return [str, delimiter, key, '=', val].join('');
}, '');
}
@hlissner
hlissner / codesign_gdb.md
Last active March 11, 2024 07:09
Codesign gdb on OSX