Skip to content

Instantly share code, notes, and snippets.

@twolfson
twolfson / .gitignore
Last active August 4, 2017 13:48
Screenshot proof of concept for `atom-shell`
screenshot.png
anonymous
anonymous / config.json
Created November 19, 2014 18:30
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#58595b",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
"use strict";
function jsonToSassVars (obj, indent) {
// Make object root properties into sass variables
var sass = "";
for (var key in obj) {
sass += "$" + key + ":" + JSON.stringify(obj[key], null, indent) + ";\n";
}
// Store string values (so they remain unaffected)
@Starefossen
Starefossen / remoteDataTableView.swift
Last active January 16, 2023 09:50
Remote JSON Data to tableView in iOS 8.0 (Swift)
import UIKit
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
class RemoteAPI {
func getData(completionHandler: ((NSArray!, NSError!) -> Void)!) -> Void {
let url: NSURL = NSURL(string: "http://itunes.apple.com/search?term=Turistforeningen&media=software")
let ses = NSURLSession.sharedSession()
@asmerkin
asmerkin / Vagrant.bootstrap.sh
Last active June 13, 2022 12:45
A simple LAMP Vagrantfile and Bootstrap file for Vagrant and ubuntu/trusty64 box. It uses mpm-workers and php5-fpm + some extra tools like grunt, gulp and composer.
#!/usr/bin/env bash
# ---------------------------------------
# Virtual Machine Setup
# ---------------------------------------
# Adding multiverse sources.
cat > /etc/apt/sources.list.d/multiverse.list << EOF
deb http://archive.ubuntu.com/ubuntu trusty multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse
var f = function() {
var v = speechSynthesis.getVoices().filter(function(v) { return v.name == 'Hysterical'; })[0],
s = ["ahahahaha", "stop it", "don't tickle me"],
t = new SpeechSynthesisUtterance(s[~~(Math.random()*s.length)]);
t.voice = v; speechSynthesis.speak(t);
};
Array.prototype.slice.call(document.querySelectorAll('a')).forEach(function(a) {
a.addEventListener('mouseover', f);
});
// Photoshop Script to Create iPhone Icons from iTunesArtwork // // WARNING!!! In the rare case that there are name collisions, this script will // overwrite (delete perminently) files in the same folder in which the selected // iTunesArtwork file is located. Therefore, to be safe, before running the // script, it's best to make sure the selected iTuensArtwork file is the only // file in its containing folder. // // Copyright (c) 2010 Matt Di Pasquale // Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@petele
petele / seamless.js
Last active February 2, 2022 18:53
Want to know how much money you've spent on Seamless in your lifetime? Pop over to your Order History page (https://www.seamless.com/Food-Delivery/orderhistory.m), scroll all the way to the bottom so it stops loading any more results, then open the Console in the Chrome DevTools and paste this chunk of code in. Voila! The number of orders you've…
// This probably doesn't work anymore.
let lines = "";
var orders = $("tbody#OrderHistoryLikedItem tr");
var count = 0;
var amount = 0.0;
for (var i = 0; i < orders.length; i++) {
try {
var tr = $(orders[i]);
var d = tr.find("td.date strong")[0].innerText.trim();
var v = tr.find("td.vendor a")[0].innerText.trim();