Skip to content

Instantly share code, notes, and snippets.

View steve-kasica's full-sized avatar

Steve steve-kasica

View GitHub Profile
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@nachiket-p
nachiket-p / meteor_servercall.html
Created June 21, 2012 07:41
Meteor: Calling server method from client
<head>
<title>meteor_servercall</title>
</head>
<body>
{{> simple}}
{{> passData}}
</body>
<template name="simple">
@thinkAmi
thinkAmi / example.js
Last active March 20, 2020 05:13
GoogleAppsScriptでRSS2.0フィードを出力する例 (使う時は、.jsを.gsにする)
function doGet() {
var rss = makeRss();
rss.setTitle('RSS 2.0 test');
rss.setLink('http://example.com');
rss.setDescription('RSS 2.0のテスト');
rss.setLanguage('ja');
rss.setAtomlink('http://example.com/rss');
for (var i = 1; i < 3; i++){
@pbogden
pbogden / Base.png
Last active April 22, 2019 10:52
pan & zoom a png
Base.png
@jaymiejones86
jaymiejones86 / bootstahp.html
Created March 17, 2014 04:46
Bootstrap Kitchen Sink from divshot
<!doctype html>
<html>
<head>
<title>White Plum Kitchen Sink - Bootstrap 3 Theme</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../dist/css/bootstrap.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
@ryanmaclean
ryanmaclean / yosemite_wallpaper.sh
Last active May 23, 2018 04:13
Change Yosemite Wallpaper from Command Line
# This script changes the Apple Mac OSX wallpaper in 10.10 for the current user
# to Earth Horizon - feel free to set a different JPEG or download, then set it!
# Cribbed from this answer: http://stackoverflow.com/a/2119076
#
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/Earth Horizon.jpg"'
@oshliaer
oshliaer / 3acd892713c001e9a579.md
Last active December 27, 2019 03:30
Batch import CSV to a Spreadsheet #gas #sheet #csv
anonymous
anonymous / ieee-alpha-sorted.csl
Created February 24, 2017 05:30
IEEE style, sorted alphabetically, csl file
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
<!-- This style was edited with the Visual CSL Editor (http://editor.citationstyles.org/visualEditor/) -->
<info>
<title>IEEE-Alpha-sorted</title>
<id>http://www.zotero.org/styles/ieee-alpha-sorted</id>
<link href="http://www.zotero.org/styles/ieee-alpha-sorted" rel="self"/>
<link href="http://www.ieee.org/documents/style_manual.pdf" rel="documentation"/>
<link href="http://www.ieee.org/documents/auinfo07.pdf" rel="documentation"/>
<author>
@pstuffa
pstuffa / .block
Last active January 5, 2018 18:38
Rorschach IV
license: mit