Skip to content

Instantly share code, notes, and snippets.

def foo(bar, a: 1, b: 2)
puts a.inspect
end
args = { a: 2 }
foo(true, args)
/*
https://webapps.stackexchange.com/questions/100820/how-do-i-invite-all-team-members-to-a-new-slack-channel#answer-104062
Instructions: Just browse to the appropriate channel and paste
this script (below) into your Chrome/Firefox dev console and hit enter.
Then wait for the script to run until it completes.
It might take time as there is a limit to how many users may be invited at once.
The script will loop until all team members are invited.
*/
var foundAny=false;
function selectAllByLetter(remainingLetters) {
@pinglamb
pinglamb / Dockerfile
Created August 8, 2016 17:39
Haproxy X Docker
FROM haproxy:latest
RUN apt-get update
RUN apt-get install -y netcat-openbsd
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
EXPOSE 80
@pinglamb
pinglamb / fukong.go
Last active August 8, 2016 17:36
Soukay.go
package main
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/PuerkitoBio/goquery"
)
@pinglamb
pinglamb / Dockerfile
Created August 8, 2016 03:01
Rails Docker Deployment
FROM ensogo/passenger-ruby23:0.9.18
MAINTAINER developers@ensogo.com
ENV HOME /root
CMD ["/sbin/my_init"]
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get update
# Upgrade Passenger
@pinglamb
pinglamb / data.json
Last active July 25, 2016 19:24
happypotter.io
{
"import_token": "4hSPTrQia5GqfmKm442Rzy7c",
"data": [
{
"sku": "P300-1",
"name": "T-Shirt",
"category": "Fashion",
"price": 399,
"stock": 24
},
@pinglamb
pinglamb / rails_server
Last active June 21, 2016 10:00
Control remote app like a charm
#!/usr/bin/env bash
# Dependencies:
# - inotify-tools
MY_PIDFILE=tmp/pids/my.pid
PUMA_PIDFILE=tmp/pids/puma.pid
case $1 in
"start")
@pinglamb
pinglamb / ddns-start
Created June 12, 2016 11:00
Cloudflare ASUS Custom DDNS Script
#!/bin/sh
EMAIL= # Your Email
ZONEID= # Your zone id, hex16 string
RECORDID= # You DNS record ID, hex16 string
RECORDNAME= # Your DNS record name, e.g. sub.example.com
API= # Cloudflare API Key
IP=${1}
curl -fs -o /dev/null -XPUT "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$RECORDID" \
@pinglamb
pinglamb / reproduction.diff
Last active August 29, 2015 14:16
Rails Issue #19192 - reproduction script diff
diff --git a/produce.rb b/produce.rb
index 9c531f3..ad34718 100644
--- a/produce.rb
+++ b/produce.rb
@@ -31,10 +31,11 @@ ActiveRecord::Schema.define do
create_table :post_tags, force: true do |t|
t.integer :post_id
t.integer :tag_id
+ t.datetime :created_at
end
@pinglamb
pinglamb / changelog.rb
Created February 26, 2015 10:21
Changelog class for per user changes dialog
class Changelog
# Put your available versions in the array, in reverse release order, e.g. %w(1.1 1.0 0.9.9999999)
VERSIONS = %w().freeze
class << self
# e.g. Changelog.after('1.0')
def after(version)
changes = Changelog.new
if index = VERSIONS.index(version)
VERSIONS[0...index].collect {|v| changes[v] }.flatten