Skip to content

Instantly share code, notes, and snippets.

View radiosilence's full-sized avatar
🔥

James Cleveland radiosilence

🔥
View GitHub Profile
@radiosilence
radiosilence / gist:5891672
Created June 29, 2013 16:01
Xresources for urxvt
!URxvt.font: -*-unifont-medium-*-*-*-16-*-*-*-*-*-*-*
!URxvt.boldFont: -*-unifont-medium-*-*-*-16-*-*-*-*-*-*-*
! Terminus
!URxvt.font: -*-terminus-medium-*-*-*-16-*-*-*-*-*-iso10646-*
!URxvt.boldFont: -*-terminus-bold-*-*-*-16-*-*-*-*-*-iso10646-*
! Tamzen
URxvt.font: -misc-tamzen-medium-r-normal--17-*-*-*-*-*-iso8859-1
URxvt.boldFont: -misc-tamzen-bold-r-normal--17-*-*-*-*-*-iso8859-1
! Source Sans
!URxvt.font: xft:Source Code Pro:size=7
myArray = [{:key => nil, :x => nil}, {:z => nil}, {:potato => "hi", :deep => {:deep => {:deep => "asf" } } } ]
print myArray
print "\n"
potato = "hi"
# IMMUTABLE VERSION: make a new array but with hashes that are either the same exact hash or an updated version
myArray2 = myArray.map do |hash|
hash.key?(:key) ? hash.merge({:key => potato}) : hash
end
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
- message: test psot 8
id: '220955331788460_220956781788315'
comments:
data:
- message: test comment
id: '220958945121432'
paging:
cursors:
before: >-
WTI5dGJXVnVkRjlqZAFhKemIzSTZANakl3T1RVNE9UUTFNVEl4TkRNeU9qRTFNakl5TlRReE1qVT0ZD
import * as moment from 'moment'
for (let i = 0; i < 12; i++) {
const start = moment('2018-02-28')
console.log(start.add(i * 30, 'd').format('DD MMMM YYYY'))
}
@radiosilence
radiosilence / example.ts
Last active April 21, 2017 13:09
I am having a confuse about generics
interface Z {
potato: string
}
abstract class A<T> { // I want to indicate that T will always at least implement Z
protected foo(bar: T) {
console.log(bar.potato); // ERROR: [ts] Property 'potato' does not exist on type 'T'
}
}
@radiosilence
radiosilence / gist:4040553
Created November 8, 2012 18:19
RequireJS with Zurb Foundation
requirejs.config({
shim: {
'foundation/jquery.foundation.topbar': {
deps: ['jquery'],
},
'foundation/jquery.cookie': {
deps: ['jquery']
},
'foundation/jquery.event.move': {
deps: ['jquery']
@radiosilence
radiosilence / beautiful.sql
Last active August 14, 2016 11:16
Django Raw Annotations. I wanted to add some complex aggregates, but .extra(select=) adds your raw SQL to GROUP BY, which doesn't work for aggregates. So, I trick the annotate() function by creating my own class that pretends to be an aggregate, but really just dumps SQL. Do not use for user inputted data.
SELECT "businesses_business"."id", "businesses_business"."user_id", "businesses_business"."slug", "businesses_business"."name", "businesses_business"."business_type_id", "businesses_business"."street", "businesses_business"."additional", "businesses_business"."town", "businesses_business"."county", "businesses_business"."postcode_id", "businesses_business"."phone_number", "businesses_business"."fax_number", "businesses_business"."email", "businesses_business"."website", "businesses_business"."strapline", "businesses_business"."description", "businesses_business"."active", "businesses_business"."deleted", "businesses_business"."activation_code", "businesses_business"."created_on", "businesses_business"."account_confirmed", "businesses_business"."preview", "businesses_business"."paid", "businesses_business"."last_updated", "businesses_business"."copy_id", "businesses_business"."logo", "businesses_business"."security_reference", "businesses_business"."video", "businesses_business"."embed_url", "businesses_busine
@radiosilence
radiosilence / comments.json
Created January 14, 2014 17:04
Shitty first attempt at something with React.
[{"author":"Barry Smith","text":"Test"},{"author":"James Brown","text":"ASDFG!"}]
[{"author":"Barry Smith","text":"Test"},{"author":"James Brown","text":"ASDFG!"}]