Skip to content

Instantly share code, notes, and snippets.

@codebycliff
codebycliff / MapNetworkDrive.ps1
Created October 10, 2012 20:20
PowerShell Snippets
$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive("r:", "\\romeobox\files", $false, "domain\user", "password")
@codebycliff
codebycliff / index.html
Created October 11, 2012 16:31
Hello, CS At Once! 2
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>$title</title>
$styles
</head>
<body>
<h1>$title</h1>
@codebycliff
codebycliff / js-examples.js
Created January 15, 2013 05:05
JS Tidbits
alert(this)
window.alert(window)
location.href = "http://google.com";
var o = new Object();
o.name = "bob";
o.age = 37;
@codebycliff
codebycliff / .rvmrc
Created April 19, 2013 01:25
Some RVM flags
export rvm_path="$HOME/.rvm"
export rvm_pretty_print_flag=1
export rvm_install_on_use_flag=1
export rvm_gemset_create_on_use_flag=1
export rvm_make_flags="-j2"
export rvm_trust_rvmrcs_flag=1
@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.")
*/
@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 / 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 / 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 / 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 / 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/"'