Skip to content

Instantly share code, notes, and snippets.

View frazras's full-sized avatar
💭
Coding for honey 🍯

Rohan Smith frazras

💭
Coding for honey 🍯
View GitHub Profile
@brittongr
brittongr / gist:872371
Created March 16, 2011 11:55
NumericField.js
/**
* Copyright(c) 2011
*
* Licensed under the terms of the Open Source LGPL 3.0
* http://www.gnu.org/licenses/lgpl.html
* @author Greivin Britton, brittongr@gmail.com
*
* @changes
* No currency symbol by default
* No decimalPrecision in config
@samsm
samsm / Transloadit Assembly Test.html
Created April 18, 2011 15:41
A quick way to try out assemblies with Transloadit without any backend support.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Transloadit</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://assets.transloadit.com/js/jquery.transloadit2.js"></script>
<script type="text/javascript">
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
xdebug.remote_host=localhost
;xdebug.profiler_enable_trigger=1
;xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128
@ry8806
ry8806 / jplayer-directive.js
Last active May 20, 2016 14:44
AngularJS and jPlayer directive
myApp.directive("jplayer", ['$window', 'PlayerService', function ($window, PlayerService) {
return {
restrict: "E",
// Have our own scope - we only want to watch the service and not conflict with other scopes
scope: {},
// Serve up some html with our player
templateUrl: "/jplayer-template.html",
link: function (scope, element, attrs) {
// An element on the page to attach the jPlayer to. Could also use "element" from linkFN ^
var jPlayer = angular.element("#jquery_jplayer_1").jPlayer();
@billyriantono
billyriantono / dnsmasq.conf
Last active March 19, 2018 13:55
/etc/init.d/vpnserver file for softether using Local Bridge
interface=tap_soft
dhcp-range=tap_soft,192.168.100.50,192.168.100.60,24h
dhcp-option=tap_soft,3,192.168.100.1
dhcp-option=tap_soft,option:dns-server,165.21.83.88,165.21.100.88
@carlthuringer
carlthuringer / gist:2691146
Created May 14, 2012 01:19
While looking at 'My Library' on Audible, get it to show all titles for all time, then use this script to store a list of normalized, deduped titles.
var titles = '';
$('a[name="tdTitle"]').each(function(el){var text = $(this).html(); text = text + "\n"; titles = titles + (text.search('Part') > 0 ? (text.search('Part 1') > 0 ? text : '') : text).replace(' (Unabridged)', '').replace(' Part 1', '')});
@3dd13
3dd13 / generate_ssh_keys.rb
Created January 20, 2011 16:59
chef recipe to generate ssh key for a user
define :generate_ssh_keys, :user_account => nil do
username = params[:user_account]
raise ":user_account should be provided." if username.nil?
Chef::Log.debug("generate ssh skys for #{username}.")
execute "generate ssh skys for #{username}." do
user username
creates "/home/#{username}/.ssh/id_rsa.pub"
@dhoerl
dhoerl / HowTo.txt
Created January 27, 2012 13:10
Converting a NSDictionary to a Binary PList
When I posted this on Apple’s Cocoadev listserver, I never did get pointers to code to convert a NSDictionary to a binary formatted plist, but did get pointers to look at NSPropertyListSerialization - something I had already (mis)read a few times.
The description for the dataFromPropertyList class method seems confusing if you don't understand that you can create a property list with no keys: that is, you can create one with a single compliant object, and the key becomes "root".
So, in the unlikely event that some else someday has the same mental block, here is actual tested code that takes a NSDictionary and creates a binary plist file:
NSDictionary *dict;
char *payload = "This is the payload";
dict = [NSDictionary dictionaryWithObjectsAndKeys:
$('form :input').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId+']')).length === 1) {
$(elem).attr('placeholder', $(label).html());
@makeusabrew
makeusabrew / label-to-placeholder.js
Created May 22, 2011 18:32
Simple jQuery snippet to convert form labels into inline placeholders
$("form :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).html());
$(label).remove();
}
});