Skip to content

Instantly share code, notes, and snippets.

View elliotchance's full-sized avatar
🤓
Building awesome stuff with V

Elliot Chance elliotchance

🤓
Building awesome stuff with V
View GitHub Profile

The Scope class regulates lexical scoping within CoffeeScript. As you generate code, you create a tree of scopes in the same shape as the nested function bodies. Each scope knows about the variables declared within it, and has a reference to its parent enclosing scope. In this way, we know which variables are new and need to be declared with var, and which are shared with the outside.

Import the helpers we plan to use.

{extend, last} = require './helpers'

@elliotchance
elliotchance / .vimrc
Last active August 7, 2017 01:17
My vimrc
" INSTALL (run this):
" cd ~ && curl -s https://gist.github.com/elliotchance/5801752/download | tar -x --strip-components=1 && cat .vimrc | grep '^\"% ' .vimrc | cut -c 3- | bash
" Lines started with % will be executed on install:
"
"% # install ctags-exuberant
"% if [ ! -f /usr/local/bin/ctags ]; then
"% wget http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz
"% tar -zxf ctags-5.8.tar.gz
"% cd ctags-5.8 && ./configure && make && sudo make install && sudo rm -f /usr/bin/ctags && sudo ln -s /usr/local/bin/ctags /usr/bin/ctags && cd ..
@abreckner
abreckner / waitsForAndRuns.js
Created May 9, 2014 01:56
Jasmine 2 plug in to re-enable waitsFor and runs functionality
// This is the equivalent of the old waitsFor/runs syntax
// which was removed from Jasmine 2
waitsForAndRuns = function(escapeFunction, runFunction, escapeTime) {
// check the escapeFunction every millisecond so as soon as it is met we can escape the function
var interval = setInterval(function() {
if (escapeFunction()) {
clearMe();
runFunction();
}
}, 1);
@leongersen
leongersen / TypeHint.js
Last active October 31, 2021 08:58
Proof of concept for adding type-hinting to JavaScript.
// Set testable values;
window.Type = {
Number: 1,
String: 'a',
Function: function(){}
}
// Add a hint method;
Function.prototype.hint = function(){
package main
import (
"fmt"
"strings"
"sync"
"time"
)
type ChannelPerf struct {
@BretFisher
BretFisher / .travis.yml
Created February 15, 2016 21:26
Travis-CI Docker Image Build and Push to AWS ECR
sudo: required #is required to use docker service in travis
language: php #can be any language, just php for example
services:
- docker # required, but travis uses older version of docker :(
install:
- echo "install nothing!" # put your normal pre-testing installs here
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@jehaby
jehaby / README.md
Last active January 25, 2024 14:43 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`