Skip to content

Instantly share code, notes, and snippets.

@codebycliff
codebycliff / PocketBookmarklet.js
Created January 13, 2014 21:32
The pocket bookmarklet modified to add the tag "archive" automatically.
var PKT_D = "getpocket.com";
var PKT_STATUS = "3";
try {
if (ISRIL_TEST) {}
} catch (e) {
ISRIL_TEST = false
}
var PKT_BM_OVERLAY = function (e) {
this.inited = false;
this.saveTagsCallback = e.saveTagsCallback
@codebycliff
codebycliff / image.py
Created December 23, 2013 05:18
Some python code for manipulating and managing photos.
#!/usr/bin/env python
""" This module consists of several classes that help with image management
and image manipulation. It also contains several functions that together
make up complete program, and therefore this module can be executed as a
script itself. It also contains a work-in-progress shell for performing
many of the available operations interactively.
@author: Cliff Braton
@contact: [email protected]
"""
function uri-encode {
echo "$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1")"
}
function google-image-search {
echo "https://www.google.com/search?q=$(uri-encode "$*")&safe=off&espv=210&es_sm=93&source=lnms&tbm=isch&sa=X&ei=5tSGUrn9G4my2wWlhYDIAQ&ved=0CAkQ_AUoAQ&biw=1360&bih=944"
}
@codebycliff
codebycliff / Rename.bat
Created October 29, 2013 22:38
Remove .bc! From file extensions (taken from http://www.utorrent.com/help/guides/migrate)
@for /r %i in (*.bc!) do @move "%~fi" "%~dpni"
@codebycliff
codebycliff / ReadingList
Created October 28, 2013 22:38
AppleScript command for adding entry to safari reading list.
osascript -e 'tell application "Safari" to add reading list item "http://totl.net/"'
@codebycliff
codebycliff / HideDotfiles.ps1
Created October 21, 2013 23:23
Hide all non-hidden dotfiles using powershell
Get-ChildItem "C:\" -recurse -force
| Where-Object {
$_.name -like ".*"
-and
$_.attributes -match 'Hidden' -eq $false
}
| Set-ItemProperty -Name Attributes -Value ([System.IO.FileAttributes]::Hidden)
@codebycliff
codebycliff / flipper.less
Last active December 24, 2015 02:59
CSS animation for tile flipping
.flip-container {
perspective: 1000;
.flipper {
transition: 0.6s; /* all .4s ease-in-out */
transform-style: preserve-3d;
position: relative;
}
.front, .back {
backface-visibility: hidden;
position: absolute;
@codebycliff
codebycliff / index.ejs
Created September 26, 2013 01:59
Knockout example using node.js (express)
<!DOCTYPE html>
<html>
<head>
<title><%= "Dynamic Dispatch" %></title>
<link rel='stylesheet' href='/stylesheets/application.css' />
<script src='/components/jquery/jquery.min.js' type='text/javascript'></script>
<script src='/components/knockout/knockout.js' type='text/javascript'></script>
<script type='text/javascript'>
function GithubProjectViewModel() {
@codebycliff
codebycliff / Example.cs
Created September 5, 2013 18:01
A settings Enum that can read from the appSettings section in the web.config through extension methods allowing for strongly typed setting keys and easy retrieval of their values.
using System.Linq;
using TweetSharp;
public class Example {
public static void Main(string[] args) {
// Get setting values
string consumerKey = Setting.TwitterConsumerKey.GetValue<string>();
string consumerSecret = Setting.TwitterConsumerSecret.GetValue<string>();
@codebycliff
codebycliff / Person.js
Created June 17, 2013 21:57
The JavaScript generated for a simple CoffeeScript class with explanations / annotations.
/* CoffeeScript:
class Person
constructor: (@name, @age) ->
@createdAt = new Date()
isAdult: => @age > 18
talk: => console.debug("Hello. My name is #{@name} and I'm #{@age} years old.")
*/