Loading development environment (Rails 3.1.3)
1.9.3p0 :002 > Resque::Worker.working.each{|w| w.done_working}
# Removes data from your connection's CURRENT database.
[ | |
{ | |
"code": "AED", | |
"name": "UAE Dirham", | |
"country": "United Arab Emirates", | |
"countryCode": "AE", | |
"flag": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAG5SURBVHja7JdLihRBEEBfVqUU6rQNggiCFxA8gswFRNy49gAeQdx4G8HbuHDvRkRUnKxPZ2dGhous6Y9TtavPZmITtYggXsWPSKOqrCkFK8stgAFKoOr1kiKAt8CD76/f/KYYj//u7bPpU28Mn199eGiBLabg7uWLUePLp08mB/j66xvA1gKVSkK9J/29guuxNCZrVX60905qZlD0xvd5XbPvmN22uo+XCFDZXI2Idjt0txuk9TFM+ve7Yk9MAkAPIKSuI3XdoEMX/aQAd4qSfYpHAI0RbVt0FGA/KYAtyvMMaBTUObRpBh2a0E3cgspewkkJQkDqGm3bQfNPL9/PtIQ+cmjC5OqbTaj9qppRcglCAFej3h9H8P9xnBUgCtRNBllYDj0QmxbWAkgxggiktFjg60PosAeMJnQtAIkRq7poBlIfK5cgRBQdzYC1dtLgVVVRluUJgEQo7XH0RminlBDCKUDK99AIwByXs4gcb0JJafaFc7aCjTlktQBIqpiVAPIYas5AcXEx6LCRzaxjKAn4465GjZ1zs13GBngMPAceLbyFfwJfTP8m2PR6SfGAM7eP07UB/g0Aw73uXdMbeJMAAAAASUVORK5CYII=" | |
}, | |
{ | |
"code": "AFN", |
class String | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
def black; "\e[30m#{self}\e[0m" end | |
def red; "\e[31m#{self}\e[0m" end | |
def green; "\e[32m#{self}\e[0m" end | |
def brown; "\e[33m#{self}\e[0m" end | |
def blue; "\e[34m#{self}\e[0m" end |
{ | |
"categories":{ | |
"1":"cms", | |
"2":"message-boards", | |
"3":"database-managers", | |
"4":"documentation-tools", | |
"5":"widgets", | |
"6":"web-shops", | |
"7":"photo-galleries", | |
"8":"wikis", |
# This is the content of variable request.env | |
# We get this content in controller: | |
# class BlogsController < ApplicationController | |
# def index | |
# render plain: "Response: #{ YAML::dump(request.env) }" | |
# end | |
# end | |
async function sha256(message) { | |
// encode as UTF-8 | |
const msgBuffer = new TextEncoder().encode(message) | |
// hash the message | |
const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer) | |
// convert ArrayBuffer to Array | |
const hashArray = Array.from(new Uint8Array(hashBuffer)) |
import { useEffect, useState } from 'react' | |
import { adDevice } from "./lib/dfp/const" | |
export default function AdSlot (props) { | |
const { id, customStyle } = props | |
const [showAdd, setShowAdd] = useState(false) | |
useEffect(() => { | |
if ((window.screen.width < 768 && adDevice[id] !== "d") || |
async function handleRequest(req) { | |
const res = await fetch(req) | |
if (res.status == 404) { | |
let init = {...res}; | |
init.status = 200; | |
init.statusText = "OK"; | |
init.webSocket = init.webSocket || undefined; | |
let response = await (new Response(res.body, init)) | |
console.log('overwrite status', response.status) |
import re | |
keywords = { | |
'greet': ['.*hello.*', '.*hi.*', '.*howdy.*', '.*hullo.*', '.*how-do-you-do.*'], | |
'track': ['.*shipment.*', '.*track.*', '.*estimated.*delivery.*'], | |
'tracking_fullfilment': ['.*myorder:*.'], | |
'stock': ['.*stock.*', '.*out-of-stock.*'], | |
'stock_fullfilment': ['.*product_stock:.*'] | |
} |
class Phone | |
attr_accessor :num, :code | |
def initialize(num, code) | |
self.code = code | |
self.num = num | |
end | |
def to_num | |
rec = num.gsub(/[^\d]/, '') |