Skip to content

Instantly share code, notes, and snippets.

View singhshivam's full-sized avatar
:octocat:
I think, therefore I am

Shivam Singh singhshivam

:octocat:
I think, therefore I am
View GitHub Profile
@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active June 24, 2024 22:11
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@magnetikonline
magnetikonline / dumprequest.php
Last active July 18, 2024 19:50
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']
@meshivam
meshivam / mp3edit.rb
Created August 30, 2015 14:49
A Ruby script to fix names of iPod recovered files in file system.
require "id3tag"
require "fileutils"
puts "enter absolute path to music folder:"
indir = gets.chomp
# Example: "/home/shivam/Music/Music/F01"
indir = indir.sub(/\/$/, "") + "/*"
puts "enter extraction path (absolute):"
outdir = gets.chomp
@awjuliani
awjuliani / softmax.ipynb
Last active September 14, 2021 20:52
A simple ipython notebook that walks through the creation of a softmax regression model using MNIST dataset.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nobitagit
nobitagit / iterm2.md
Last active August 24, 2023 12:16
iterm2 cheatsheet

This gist has been moved to its own Github repo, so it's easier to contribute with additions and corrections. Please open a PR there if you see any mistake, I don't track comments on here as there's no notification system for gists AFAIK. Thanks.

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
@singhshivam
singhshivam / Immutable JS Examples
Last active August 5, 2023 19:16
Immutable JS Examples
List()
var list = Immutable.List([1,2,3])
// [1, 2, 3]
List.isList()
Immutable.List.isList(list)
// true
List.of()
var list = Immutable.List.of(1,2,3);
@victorouse
victorouse / dom.html
Created March 4, 2018 04:57
Facebook Interview: Given two identical DOM tree structures, A and B, and a node from A, find the corresponding node in B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Facebook DOM Traversal</title>
</head>
<body>
<div id="rootA">
<div>
@RohitAwate
RohitAwate / concurrency.go
Created May 2, 2019 13:36
Code from the YouTube video: Concurrency in Golang: A Simple, Practical Example (https://youtu.be/3atNYmqXyV4)
package main
import (
"fmt"
"log"
"net/http"
"os"
"sync"
)