Skip to content

Instantly share code, notes, and snippets.

View paulomcnally's full-sized avatar
:octocat:
JS

Paulo McNally paulomcnally

:octocat:
JS
View GitHub Profile
// Answer to http://github.com/ry/http-parser/issues/#issue/1
// UNTESTED
struct line {
char *field;
size_t field_len;
char *value;
size_t value_len;
};
var http = require('http');
exports.query = function(cb) {
var cbCalled = false;
http.get({ host: 'jsonip.com' }, function(res) {
var buffer = '';
res.setEncoding('utf8');
res.on('data', function(d) {
buffer += d;
@arpit
arpit / Android TimeZone Ids
Created June 20, 2011 13:26
List of all Android TimeZone ids
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@diegok
diegok / mercadopago.rb
Created January 8, 2012 19:34
Small ruby object to interact with MercadoPago API
class MercadoPago
require 'rubygems'
require 'json/add/core'
require 'uri'
require 'net/https'
attr_accessor :client, :secret, :currency
def initialize(options={})
@client = options[:client_id]
@ry
ry / fib.js
Created March 12, 2012 00:17
a proper fibonacci server in node. it will light up all your cores.
var http = require('http')
var fork = require('child_process').fork;
function fib(n) {
if (n < 2) {
return 1;
} else {
return fib(n - 2) + fib(n - 1);
}
}
@23maverick23
23maverick23 / font_awesome.rb
Last active January 30, 2022 11:38
Jekyll: Font Awesome icons Liquid tag
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Ryan Morrissey
#
# 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
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active June 11, 2024 14:17
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@daniellevass
daniellevass / android_material_design_colours.xml
Last active June 5, 2024 13:54
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@edasque
edasque / gist:bd8aa4087c843e31e38d
Created August 30, 2014 22:31
Phonegap / Cordova Logcat - filtering
adb logcat CordovaActivity:V CordovaWebView:V CordovaWebViewClient:V IceCreamCordovaWebViewClient:V CordovaLog:V *:S
@pulkitsinghal
pulkitsinghal / common_models_MyModel.js
Last active January 5, 2016 13:57
Fetch user for remote methods in loopback v2.8.5
var loopback = require('loopback');
module.exports = function(MyModel) {
//remote method
MyModel.importProducts = function(storeConfigId, storeId, cb) {
//cb(null, sound + ' ' + sound + ' ' + sound);
var ctx = loopback.getCurrentContext();
console.log(loopback.getCurrentContext());