Skip to content

Instantly share code, notes, and snippets.

import os.path as path
import string
import argparse
import glob
import re
def basename(filename):
base = filename
if filename.find('@2x') > 0:
base = filename[:filename.find('@2x')]
@icecreammatt
icecreammatt / like-button.js
Created March 3, 2013 20:16
Like button example
<div class="fb-like" data-href="http://example.com/" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true"></div>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
@icecreammatt
icecreammatt / error_log.sh
Created March 3, 2013 20:23
Script that lets the error log stream as new items are added to it.
sudo tail -f /var/log/apache2/error.log
function decodeHtmlElements(string) {
var htmlText = document.createElement("DIV");
MSApp.execUnsafeLocalFunction(function () {
htmlText.innerHTML = string;
});
return htmlText.textContent || htmlText.innerText || "";
}
#include <iostream>
using namespace std;
int main() {
int total = 11;
while(total--) {
if(total == 0) {
cerr << "Unable to divide by zero\n";
} else {
@icecreammatt
icecreammatt / reset-and-update-all.sh
Last active August 29, 2015 13:55
Reset hard and update all git folders in the current directory
#!/bin/bash
for app in $(ls -d */); {
echo $app;
cd $app;
git reset --hard;
git fetch --all;
git rebase origin/master;
git submodule update;
cd ..;
@icecreammatt
icecreammatt / .gitignore
Created March 28, 2014 17:52
Sublime Text gitignore
Packages/*
Pristine\ Packages
Installed\ Packages
Session.sublime_session
Backup/
.DS_Store
*.swp
!Packages/User
Settings/License.sublime_license
Cache
@icecreammatt
icecreammatt / install-java.sh
Created April 2, 2014 17:30
Install's Java 7 on Ubuntu 12.04
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
apt-get update
apt-get install -y software-properties-common python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java7-installer curl
apt-get upgrade -y
@icecreammatt
icecreammatt / regfix.php
Created April 7, 2014 22:29
For fixing Drupal Registory after moving folder location
<?php
define('DRUPAL_ROOT', getcwd());
$_SERVER['HTTP_HOST'] = 'default';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['QUERY_STRING'] = '';
$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] = '/';
$_SERVER['HTTP_USER_AGENT'] = 'console';
@icecreammatt
icecreammatt / install-redis.sh
Created April 7, 2014 23:49
Install's the latest stable redis release
#!/bin/bash
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
cp src/redis-server /usr/local/bin
cp src/redis-cli /usr/local/bin