This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <X11/X.h> | |
#include <X11/Xlib.h> | |
#include <X11/Xutil.h> | |
#include <GL/gl.h> | |
#include <GL/glx.h> | |
#include <GL/glu.h> | |
struct Hints { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random | |
def mutator(): | |
mutated = False | |
chars = list(mutator.mutatee) | |
for i, ch in enumerate(chars): | |
if not mutated and ch.isalnum() and random.random() > 0.999: | |
if ch.isalpha(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source ~/.rvm/scripts/rvm | |
rvm use 2.3.1@bin && ruby -e "require 'active_support/time'; puts DateTime.parse(\"$1\").in_time_zone('America/Los_Angeles')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias nuke-nuke-branch="nnuke_branch" | |
alias nuke-branch="nuke_branch" | |
function nuke_branch() | |
{ | |
if [ $# -eq 1 ]; then | |
git clean -f -d | |
git rebase --abort | |
git branch -D tempbranch &> /dev/null | |
find . -name "post-checkout" | xargs rm -rf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> a = String.new | |
=> "" | |
[2] pry(main)> b = String.new | |
=> "" | |
[3] pry(main)> a.class.send(:define_method, "available_on_all_strings") { |a, b| "And the result is: " + a.to_s + b.to_s } | |
=> :available_on_all_strings | |
[4] pry(main)> a.available_on_all_strings(1, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> a = Object.new | |
=> #<Object:0x007f90fc8f40f0> | |
[2] pry(main)> a.singleton_class | |
=> #<Class:#<Object:0x007f90fc8f40f0>> | |
[3] pry(main)> a.singleton_class.send(:define_method, "asdf") { |a| "hi there " + a } | |
=> :asdf | |
[4] pry(main)> a.asdf | |
ArgumentError: wrong number of arguments (0 for 1) | |
from (pry):3:in `block in __pry__' | |
[5] pry(main)> a.asdf("gg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> require 'json' | |
=> true | |
[2] pry(main)> [1, 2, 3].to_json | |
=> "[1,2,3]" | |
[3] pry(main)> [[1, 2, 3], [4, 5, 6], [7, 8, 9]].map &:to_json | |
=> ["[1,2,3]", "[4,5,6]", "[7,8,9]"] | |
[4] pry(main)> JSON.parse("[1,2,3]") | |
=> [1, 2, 3] | |
[5] pry(main)> ["[1,2,3]", "[4,5,6]", "[7,8,9]"].map &JSON.method(:parse) | |
=> [[1, 2, 3], [4, 5, 6], [7, 8, 9]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"C:\Program Files\gs\gs9.19\bin\gswin64.exe" -dNOPAUSE -dBATCH -sDEVICE=png16m -r600 -dDownScaleFactor=3 -sOutputFile=C:\Users\ed\Desktop\test_images\test-%%03d.jpg C:\Users\ed\Desktop\test.pdf | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void (*glGenBuffers)(GLsizei n, GLuint * buffers) = (void (*)(GLsizei, GLuint *))wglGetProcAddress("glGenBuffers"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Asset(width:Int, url:String) | |
val a = Asset(100, "asdf") :: Asset(200, "asdf") :: Asset(210, "asdf") :: Nil | |
val target = 209 | |
a.min(Ordering.by((asset:Asset) => Math.abs(target - asset.width))) |