Skip to content

Instantly share code, notes, and snippets.

View everdaniel's full-sized avatar
🏠
Working from home

Ever Daniel Barreto everdaniel

🏠
Working from home
View GitHub Profile
@colingourlay
colingourlay / app.jsx
Created February 26, 2014 23:58
Using react-router-component to drive the routing of a Cordova app (while still working as a web app).
function init() {
var HomePage = React.createClass({
render: function() {
return <div>Home</div>;
}
});
var NotFoundPage = React.createClass({
render: function() {
@FriendlyWP
FriendlyWP / posts-to-posts-list-widget.php
Created November 23, 2012 18:15
Posts 2 Posts List Widget
<?php
/*
Plugin Name: Posts 2 Posts List Widget
Plugin URI: http://friendlywebconsulting.com/
Description: Creates a widget to display posts connected via the Posts 2 Posts plugin by Scribu, found here: http://wordpress.org/extend/plugins/posts-to-posts/
Author: Michelle McGinnis
Author URI: http://friendlywebconsulting.com/
Version: 1.0.0-alpha
*/
@akshaye
akshaye / delete_duplicates.rb
Last active December 10, 2015 21:28
ruby code snippet i wrote to delete duplicate files from music folder
Dir.chdir('/Users/akshay/Music')
dupFiles = File.join('**', '* 2.mp3')
Dir.glob(dupFiles).each do |dup|
puts "duplicate file: #{dup}"
if File.exists?(dup)
orig = dup[0..-2]
puts "original file: #{orig}"
if File.exists?(orig)
if File.size(dup) == File.size(orig)
puts "deleting #{dup}"
@akshaye
akshaye / Throttling and Debouncing.md
Created January 29, 2013 11:22
Things i learned while reading Async Javascript.

When, in special circumstances, we want to prevent a function from being called too often:
Throttling - additional calls to the function are ignored for next n ms.
Debouncing - any call to the function is delayed till n ms have passed since the last call.

Both of these are easy to implement by creating meta-functions that return a wrapped version of original function:

function throttle(func, delay) {
  var lastHitDate = 0;
 return function() {
@wycats
wycats / jsonapi.md
Created May 2, 2013 04:11
Ember APIs

JSON API

There are two JSON API styles:

  • The ID Style
  • The URL Style

The ID style is the easiest to get started with, but requires that your clients be able to guess the URLs for related documents. It also locks your API into a particular URL structure, which may become a problem as your API grows.

The URL style requires less guessing on the client side, and makes clients more resilient to API changes, but is trickier to use with relationships and compound documents.

@rcrowley
rcrowley / multio.rb
Created July 28, 2010 06:15
Ruby IO multiplexer
# MultIO Ruby IO multiplexer
# http://rcrowley.org/2010/07/27/multio-ruby-io-multiplexer.html
require 'stringio'
class MultIO < Array
def <<(io)
if io.respond_to?(:to_str)
io = StringIO.new(io)
@deltaepsilon
deltaepsilon / AssetsClient.coffee
Created December 30, 2012 16:43
Part of my Meteor asset upload client code. This handle the drag and drop events and calls the createAsset method.
Template.assetUpload.events(
'drop #asset-upload-dropzone': (e) ->
e.stop()
$(e.target).removeClass 'dropzone-hover'
new AssetUpload(e)
'dragenter #asset-upload-dropzone': (e) ->
e.stop()
$(e.target).addClass 'dropzone-hover'
@marcuswestin
marcuswestin / aws-ssl-termination-digicert.md
Last active August 28, 2018 15:18
How to set up an AWS SSL terminating Elastic Load Balancer with a Digicert certificate

1: Generate CSR

openssl req -new -newkey rsa:2048 -nodes -keyout server-cert.key -out server-cert-sign-req.csr

# Country Name (2 letter code) [AU]:US
# State or Province Name (full name) [Some-State]:California
# Locality Name (eg, city) []:
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Flutterby Labs, Inc.
# Organizational Unit Name (eg, section) []:
# Common Name (eg, YOUR name) []:www.dogo.co
@WxAnalyst
WxAnalyst / TimeHeight
Created June 24, 2013 07:37
GRaDS script to run a time/height diagram from WRF output
**********************************************************
* Displays a time-height diagram for stations
* Author: John Hinsberger
*********************************************************
*Bald Mountain*
'open d01_template.ctl'
'set background 5'
'clear'
@helgatheviking
helgatheviking / custom-post-type-archive-menu-links.php
Created May 4, 2012 17:41
Adds Custom Post Type archives to the WordPress-powered menus
<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.0
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2