Skip to content

Instantly share code, notes, and snippets.

/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
// Generated on 2014-02-11 using generator-webapp 0.4.7
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
require('./config');
var jsFilesToignore = ["node_modules/**/*", "**/bower_components/**/*", "dist/app/**/*", "app/assets/**/vendor/**/*"];
module.exports = function (grunt) {
// load all grunt tasks
require('load-grunt-tasks')(grunt);
// Configuration
// Fandango Redesign Ad Scaling - jQuery ($) Required
mps._ready(function() {
mps.__scaleAds = function(adslot) {
var ADSLOT=adslot; var $aiframe = $('#'+mps.adslots[ADSLOT]+' iframe'); var $adivgpt = $('#'+mps.adslots[ADSLOT]);
if(typeof($)=='function' && typeof($aiframe)=='object' && typeof(vpSize)=='object' && vpSize.getW() < $aiframe.width()) {
window.console && console.debug('[IFRAME RESIZE: Triggered] Current Width: '+vpSize.getW()+' | Iframe Width: '+$aiframe.width());
var scalesize = vpSize.getW();
var scaleratio = (vpSize.getW() / $aiframe.width());
var scaledheight = Math.floor($aiframe.height() * scaleratio);
var scaledwidth = Math.floor($aiframe.width() * scaleratio);
Most useful shortcuts
1. Shift + Command + P -> a fast access to all possible editor options and also installed packages optinos
2. Shift + P -> Find a file: Command + P (it is possible to use @ with the function name)
3. the usual: Command + F to search in a file and Command + Shift + F to search in files
Layout options in View
- Show/Hide Sidebar
- Show/Hide Open Files
- Minimap (from View -> Hide or Show
- Split Screen

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

import mimetypes
import os
import re
from flask import request, send_file, Response
@app.after_request
def after_request(response):
response.headers.add('Accept-Ranges', 'bytes')
return response
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@MaxKramnik
MaxKramnik / BundlePlugin.js
Created June 13, 2016 05:59 — forked from mridgway/BundlePlugin.js
Bundle Plugin for Fluxible
/**
* On server, just register all of the resources directly to the plugin. On the client, pass in a loader file that maps bundle
* name to webpack bundle require (a separate entry point). Then from your action, you can call `context.loadBundle` to load
* the bundle resources. On the server, the resources are already available but on the client they will be lazy loaded by
* webpack.
*/
'use strict';
var debug = require('debug')('BundlePlugin');
var PromiseLib = global.Promise || require('es6-promise').Promise;