This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ln -nfs "~/Library/Mobile Documents/com\~apple\~CloudDocs" "~/Desktop/iCloud Drive" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "github.com/codegangsta/negroni" | |
| "github.com/julienschmidt/httprouter" | |
| "net/http" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| COUNTRIES = { | |
| "US": "United States", | |
| "AF": "Afghanistan", | |
| "AX": "Åland Islands", | |
| "AL": "Albania", | |
| "DZ": "Algeria", | |
| "AS": "American Samoa", | |
| "AD": "Andorra", | |
| "AO": "Angola", | |
| "AI": "Anguilla", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo 1 > /proc/sys/vm/overcommit_memory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ResqueStaleWorkerCleaner | |
| SLOWEST_JOB = (ENV["SLOWEST_JOB"] || 30).to_i # minutes | |
| def call | |
| Resque.workers.each do |worker| | |
| worker.unregister_worker if old_worker?(worker) | |
| end | |
| end | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Api::BaseController < ActionController::Base | |
| protect_from_forgery with: :null_session | |
| before_action :unauthorized_if_signed_out | |
| layout false | |
| def current_user | |
| @current_user ||= ( | |
| authenticate_or_request_with_http_token do |token, options| | |
| User.find_by(api_key: token) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Coders | |
| class Marshal | |
| attr_reader :klass | |
| def initialize(klass) | |
| @klass = klass | |
| end | |
| def load(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.value "Ticket", | |
| class Ticket | |
| console.log "defined once" | |
| constructor: (@price, @count) -> | |
| console.log "new instance constructed" | |
| amount: -> | |
| @price * parseInt(@count, 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create a 10 megabytes, blank, AES 256 Encrypted, with password "mypassword", | |
| # MacOS Journaled (Extended) image named "MyImage" when attached, | |
| # and myimage.dmg as filename in the current directory. | |
| # | |
| echo -n "mypassword" | hdiutil create \ | |
| -encryption AES-256 \ | |
| -stdinpass \ | |
| -size 10m \ | |
| -fs "Journaled HFS+" \ | |
| -volname MyImage \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |