Skip to content

Instantly share code, notes, and snippets.

while(s->string[i] != '\0') {
newStringData[i] = s->string[i];
i++;
}
//strcpy(newStringData, s->string);
// copy over the null terminator + the checksum value
for(int j=0;j<5;j++){
newStringData[i+j] = s->string[i+j];
}
STRINGS = ... # dictionary list

SUPERSTRINGS = ... # list of words to check


def check_string(superstring, STRINGS)
  string = get_first_string(STRINGS)
  
 while(string != null)
void broken_function(char * string, size_t length) {
if(length >= 3 &&
string[0] == 'F' &&
string[1] == 'U' &&
string[2] == 'Z' &&
string[3] == 'Z') {
do_the_thing();
}
}
@eqdw
eqdw / Cond.rb
Last active January 11, 2016 16:24
If (user_logged_in? && validated?) ||
admin_logged_in? ||
!production_data? )
Save!
End

Keybase proof

I hereby claim:

  • I am eqdw on github.
  • I am eqdw (https://keybase.io/eqdw) on keybase.
  • I have a public key whose fingerprint is DD57 8694 9D58 F659 095E 920D 4E81 7C14 22C3 8E24

To claim this, I am signing this object:

# I want to make a utility class that encapsulates a bunch of useful
# methods. It doesn't really need any state, it's really more of a
# namespace to put the methods in. Say, for example, a math utility
# Math.random => random number
# Math.sin(x) => sine(x)
# Math.PI => 3.14159265......
# etc.
# Wat do?

Keybase proof

I hereby claim:

  • I am eqdw on github.
  • I am eqdw (https://keybase.io/eqdw) on keybase.
  • I have a public key whose fingerprint is 2FA5 BEFD 659F A4AD B4B6 3ED4 CC84 3CA9 3E26 942A

To claim this, I am signing this object:

class FooController < ApplicationController
def an_action
do_thing
end
private
def do_thing
@side_effect = a_value
end
# As soon as #account returns, cls stops existing because it's a local
# so you call .calls on the returned object, which attemts to return a
# non-existant local variable. In javascript/lisp/etc cls would be retained
# in a closure.
class BrokenMockTwilioClient
def account
act = Object.new
cls = Object.new
App.Router ->
@route "Foo" # => Route is foo, FooController, model is Foo, etc
@resource "Herp", -> # => Route is herp, HerpController, model is Herp, etc
@route "Derp" # => Route is herp.derp, HerpDerpController, model is Derp (I think)
@resource "Animal", -> # => Route is animal, AnimalController, Animal, etc
@resource "Cat", -> # => route is cat, CatController, Cat, etc. BECAUSE IT IS A
# RESOURCE IT OPENS A NEW SCOPE, instead of being (for example) AnimalCatController
@route "Meow" # => Route is cat.meow, CatMeowController, model is Meow (I think)