Skip to content

Instantly share code, notes, and snippets.

View thephw's full-sized avatar
❤️
Building software with love

Patrick Howard Wiseman thephw

❤️
Building software with love
View GitHub Profile
@thephw
thephw / css_color.rb
Created February 7, 2014 19:19
A quick color helper for getting other CSS color types to RGBA, it copies it to your clipboard
########################
## Ruby color helpers ##
########################
require 'clipboard'
def css_color(text, output_type = "rgba")
if text.start_with? "#"
if text.length > 4
colors = [text[1..2].to_i(16).to_s(10), text[3..4].to_i(16).to_s(10), text[5..6].to_i(16).to_s(10), 1]
else
colors = [(text[1]*2).to_i(16).to_s(10), (text[2]*2).to_i(16).to_s(10), (text[3]*2).to_i(16).to_s(10), 1]
public static FieldViewModel GetField(this HtmlHelper<IEnumerable<FieldViewModel>> Html, string fieldId)
{
FieldViewModel field = Html.ViewData.Model.SingleOrDefault(f => f.FieldId == fieldId);
return field;
}
SELECT creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
private static MembershipContext _dbContext;
public static MembershipContext dbcontext
{
get
{
if (_dbcontext==null)
{
_dbcontext = new MembershipContext();
}
return _dbcontext;
{
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"folder_exclude_patterns":
[
".bundle",
".git",
".svn",
".sass-cache",
"doc",
"log",
##########################
## Global setup options ##
##########################
#Configure editor
export EDITOR='subl -w'
#Setup sublime alias e
alias e='subl . &'
while [ 1 ]
do
curl 'http://modernluxury.com/jezebel/best-of-atlanta-2015' -H 'Pragma: no-cache' -H 'Origin: http://modernluxury.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,es;q=0.6' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryi3wnNntJkl9q5QXz' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: no-cache' -H 'Referer: http://modernluxury.com/jezebel/best-of-atlanta-2015' -H 'Cookie: SESS3722536f853e467c06c00b1136edc34c=f2agitkb4jcrojia1od6j3dok0; __utmt=1; __gads=ID=e8878b90f2163e25:T=1420613376:S=ALNI_MYmCaUnmFIhz5o8PXqiv13UErIcAw; has_js=1; __utma=170791228.457815792.1420613376.1420613376.1420613376.1; __utmb=170791228.2.10.1420613376; __utmc=170791228; __utmz=170791228.1420613376.1.1.utmcsr=facebook.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmv=170
@thephw
thephw / response.xml
Created January 19, 2015 20:07
Twilio response to automatically unlock the door. Where 9 is the digit to unlock the door, w is wait, and the two and from address are full numbers with country code for a number that accepts SMS messages. It automatically mashes 9 so you don't have to. It's not very secure, but it does keep you from running across the room during a dinner party.
<Response>
<Play digits="w999999999"/>
<Sms from="+1xxxyyyyyy" to="+1xxxyyyyyy">Door Opened</Sms>
</Response>
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
jQuery =>
$('#navbar').scrollspy()
doWork = new ApiExample("do-work", "GET", "http://development.primeoncology.org/mobilerest.svc/dowork")
doWork.initialize()
(~) $ traceroute google.com
traceroute: Warning: google.com has multiple addresses; using 74.125.196.113
traceroute to google.com (74.125.196.113), 64 hops max, 52 byte packets
1 10.0.1.1 (10.0.1.1) 2.440 ms 1.115 ms 0.858 ms
2 73.43.56.1 (73.43.56.1) 15.836 ms 9.824 ms 11.684 ms
3 xe-9-3-0-sur02.a2atlanta.ga.atlanta.comcast.net (68.86.110.233) 9.222 ms 8.946 ms 9.529 ms
4 68.85.108.205 (68.85.108.205) 10.646 ms
xe-8-2-0-0-sur01.a2atlanta.ga.atlanta.comcast.net (68.85.111.221) 90.953 ms
68.85.172.25 (68.85.172.25) 10.419 ms
5 ae-0-0-ar01.b0atlanta.ga.atlanta.comcast.net (68.85.108.1) 10.418 ms