Skip to content

Instantly share code, notes, and snippets.

View eytanbiala's full-sized avatar

Eytan Biala eytanbiala

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@MonsieurDart
MonsieurDart / MFMailComposeViewController+URLRequest.h
Created January 20, 2011 15:46 — forked from futuretap/WebViewController.m
Intercept mailto URLs in a UIWebView and send them to a MFMailComposeViewController
#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
@interface NSURL (MailComposeViewController)
// Is the given request a mailto URL.
- (BOOL)isMailtoRequest;
@end
@bkimble
bkimble / gist:1365005
Last active May 2, 2024 01:27
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@atomicbird
atomicbird / NSObject+setValuesForKeysWithJSONDictionary.h
Created January 11, 2012 02:35
NSObject category for handling JSON dictionaries. Described in detail at http://www.cimgf.com/2012/01/11/handling-incoming-json-redux/
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@victor-falcon
victor-falcon / gist:2021125
Created March 12, 2012 10:47
Saving Contact Form 7 data into a MailChimp List
<?php
/*
Guardando email de Contact Form 7 en MailChimp
Necesita el archivo MCAPI.class.php de la API de MailChimp
En este en concreto usamos un checbox con el nombre subscribe para comprobar si el
usuario quiere subscribirse o no. En caso afirmativo guardamos el nombre y el email
en la lista concreta de nuestro MailChimp.
@rudyjahchan
rudyjahchan / NSObject_Swizzle.h
Last active August 13, 2016 08:29
Monkey-Patching iOS with Objective-C Categories Part III: Swizzling
#import <Foundation/Foundation.h>
@interface NSObject (Swizzle)
+ (void)swizzleInstanceSelector:(SEL)originalSelector
withNewSelector:(SEL)newSelector;
@end
@andywhitt
andywhitt / MailViewTestViewController.cs
Created May 9, 2012 12:59
A MonoTouch iOS Mail like example with a custom view and a UIWebView
using System;
using System.Drawing;
using System.IO;
using System.Net;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
// A MonoTouch iOS Mail like example with a custom view and a UIWebView :
//
// http://stackoverflow.com/questions/10434444/zoom-a-uiwebview-like-ios-mail-app/10463431
@mpospese
mpospese / CGRectIntegralScaled.m
Created February 28, 2013 03:34
Pixel aligns rectangles, taking the device's screen scale into account.
CGRect CGRectIntegralScaledEx(CGRect rect, CGFloat scale)
{
return CGRectMake(floorf(rect.origin.x * scale) / scale, floorf(rect.origin.y * scale) / scale, ceilf(rect.size.width * scale) / scale, ceilf(rect.size.height * scale) / scale);
}
CGRect CGRectIntegralScaled(CGRect rect)
{
return CGRectIntegralScaledEx(rect, [[UIScreen mainScreen] scale]);
}
var request = require("request");
request({
uri: "http://data.mtgox.com/api/1/BTCUSD/ticker:80",
headers: {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, compress",
"User-Agent": "HTTPie/0.3.1"
},
timeout: 10000
@mynameispj
mynameispj / responsive-iframe.css
Created April 13, 2013 21:44
Responsive Youtube embeds
.videoWrapper {
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;