Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔

Duke dukex

🤔
View GitHub Profile
@tcjr
tcjr / messages.json
Last active Dec 25, 2015
Basic pagination with Ember
View messages.json
// The API accepts the page parameter and returns the pagination info in meta
{
"messages": [ ... ],
"meta": {
"pagination": {
"total_pages": 3,
"current_page": 1,
"total_count": 55
}
View linearregression.rb
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
@wnuqui
wnuqui / gist:4653064
Last active Dec 11, 2015
3 bare bone rails applications using 3 jruby application servers (all running in heroku cedar)
View gist:4653064
# JAVA_OPTS and Procfiles
JAVA_OPTS: -Djruby.memory.max=384m -Xmx384m -Xms256m -Xss512k -XX:+UseCompressedOops -XX:+PrintGCDetails
# puma backed app's Procfile
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
# torquebox-lite backed app's Procfile
web: bin/torquebox-lite -b 0.0.0.0 -p $PORT --max-threads=8
@jensgro
jensgro / gist:3816624
Created Oct 2, 2012
The Current State Of Remote Debugging For Mobile
View gist:3816624

source: Addy Osmani https://plus.google.com/u/0/115133653231679625609/posts/Px3bQdQ2HDu

Remote debugging allows us to execute and capture code in remote devices, providing a way to inspect HTML, CSS and JavaScript and make live changes. In terms of mobile, this means a way for us to communicate with mobile devices so we can debug code on them directly rather than just relying on emulators.

The landscape for remote debugging your apps on mobile is quite strong at the moment.

Chrome for Android supports remote debugging via USB and allows you to debug using the Chrome Developer Tools. (See: https://developers.google.com/chrome/mobile/docs/debugging and Chrome for Android Remote Debugging for +Boris Smus's video walkthrough)

Opera has had support for remote debugging since 2008 and Dragonfly can remotely connect to Opera Mobile. (Tut: http://www.codegeek.net/blog/2012/mobile-debugging-with-opera-dragonfly/)

@dcrec1
dcrec1 / respond-to.sass
Created Aug 23, 2012
respond-to mixin
View respond-to.sass
$mediaPhone: 480px !default
$mediaTablet: 768px !default
$mediaDesktop: 980px !default
$mediaLarge: 1200px !default
=respond-to($media)
@if $media == phone
@media only screen and (max-width: $mediaPhone)
@content
@else if $media == tablet
View gist:3260456
(ns rss
(:use [clojure.xml :only [emit]])
(:import java.util.Date))
(defn format-time [time]
(.format (new java.text.SimpleDateFormat
"EEE, dd MMM yyyy HH:mm:ss ZZZZ") time))
(defmacro tag [id attrs & content]
`{:tag ~id :attrs ~attrs :content [~@content]})
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
@scottsbaldwin
scottsbaldwin / linearregression.rb
Created Feb 3, 2012
Ruby Linear Regression Calculator
View linearregression.rb
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
@fnando
fnando / dev.conf
Created Jul 23, 2011
Nginx configuration for SSH tunnel
View dev.conf
upstream tunnel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name dev.codeplane.com br.dev.codeplane.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
@vinibaggio
vinibaggio / call4paperz api
Created Mar 2, 2011
Api do call 4 paperz
View call4paperz api
# Index
http://www.call4paperz.com/events.json
# Show do evento
http://www.call4paperz.com/events/1.json
# Show da proposta
http://www.call4paperz.com/events/1/proposals/1.json
# Evento com JSONP (preste atenção no p no formato)