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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
import Data.List | |
import Data.Maybe | |
import System.Process | |
import Text.Regex.Posix | |
main :: IO () | |
main = do | |
(w, h) <- getScreenResolution | |
putStrLn $ show w ++ "×" ++ show h |
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
File.foreach '/usr/share/dict/web2' do |line| | |
puts line if line[/((.)\k<-1>){3}/] | |
end | |
# >> bookkeeper | |
# >> bookkeeping | |
# >> subbookkeeper | |
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
class EmailSender | |
def self.send_emails(number_of_emails, job_que_id) | |
emails = EmailQue.where(send_status: 'NOT SENT', job_que_id: job_que_id) | |
emails = emails.limit(number_of_emails) unless number_of_emails.zero? | |
errors = [] | |
emails.each do |email| | |
email_params = { | |
from: '[email protected]', # <== change this to appropriate value |
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
# == Schema Information | |
# | |
# Table name: email_ques | |
# | |
# id :integer not null, primary key | |
# job_que_id :integer | |
# to_field :string(255) | |
# subject_field :string(255) | |
# body_field :text | |
# send_status :text |
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
# == Schema Information | |
# | |
# Table name: sysdba.INF_ACC_IA_INVESTMENT | |
# | |
# INF_ACC_IA_INVESTMENTID :string(12) not null | |
# INF_ACC_INVEST_ACCOUNTID :string(12) not null | |
# CREATEUSER :string(12) | |
# CREATEDATE :datetime | |
# MODIFYUSER :string(12) | |
# MODIFYDATE :datetime |
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 ruby | |
require 'json' | |
require 'net/http' | |
require 'uri' | |
def rate_converter(from, to) | |
uri = URI('http://rate-exchange.appspot.com/currency') | |
uri.query = URI.encode_www_form(from: from, to: to) |
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 ruby | |
=begin | |
Determines total duration of all media files, passed as arguments. | |
Shells out to ffmpeg(1). | |
=end |
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 ruby | |
# -*- coding: utf-8 -*- | |
class Integer | |
def factors | |
fail if self <= 0 | |
(1...self).select { |num| (self % num).zero? } | |
end |
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
;;;###autoload | |
(define-derived-mode conf-dwarf-fortress-mode fundamental-mode | |
"Mode for editing dwarf fortress configuration files." | |
:syntax-table text-mode-syntax-table | |
(setq font-lock-defaults | |
'(( | |
("^\s*\\(\\[[^:]+:\\)\\(.*\\)\\(\\]\\)$" | |
(1 font-lock-type-face) | |
(2 font-lock-constant-face) | |
(3 font-lock-type-face)) |
NewerOlder